Improve logging and update dependencies
Enabled detailed logging for DNS record operations and adjusted log levels. Updated Maven dependencies, including httpclient5, logback, and added explicit SLF4J configurations. Minor changes to the logging configuration file and project structure for better test isolation.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>codes.thischwa</groupId>
|
<groupId>codes.thischwa</groupId>
|
||||||
@@ -33,16 +34,17 @@
|
|||||||
|
|
||||||
<!-- 3rd party dependencies -->
|
<!-- 3rd party dependencies -->
|
||||||
<jackson.version>2.18.2</jackson.version>
|
<jackson.version>2.18.2</jackson.version>
|
||||||
<httpclient5.version>5.4.2</httpclient5.version>
|
<httpclient5.version>5.4.3</httpclient5.version>
|
||||||
<lombok.version>1.18.36</lombok.version>
|
<lombok.version>1.18.36</lombok.version>
|
||||||
<logback-classic.version>1.5.12</logback-classic.version>
|
<slf4j.version>2.0.17</slf4j.version>
|
||||||
|
<logback-classic.version>1.5.18</logback-classic.version>
|
||||||
<junit5.version>5.11.4</junit5.version>
|
<junit5.version>5.11.4</junit5.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<developerConnection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</developerConnection>
|
<developerConnection>scm:git:git@gitlab.com:ths6435116/CloudflareDNS-java.git</developerConnection>
|
||||||
<connection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</connection>
|
<connection>scm:git:git@gitlab.com:ths6435116/CloudflareDNS-java.git</connection>
|
||||||
<url>https://gitlab.com/thischwa/CloudflareDNS-java</url>
|
<url>https://gitlab.com/ths6435116/CloudflareDNS-java</url>
|
||||||
<tag>HEAD</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
@@ -65,6 +67,18 @@
|
|||||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
<artifactId>httpclient5</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
<version>${httpclient5.version}</version>
|
<version>${httpclient5.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
@@ -82,11 +96,6 @@
|
|||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>${logback-classic.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
@@ -100,6 +109,12 @@
|
|||||||
<version>${junit5.version}</version>
|
<version>${junit5.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback-classic.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
String endpoint = CfRequest.RECORD_CREATE.buildPath(zone.getId());
|
String endpoint = CfRequest.RECORD_CREATE.buildPath(zone.getId());
|
||||||
RecordSingleResponse resp = postRequest(endpoint, rec);
|
RecordSingleResponse resp = postRequest(endpoint, rec);
|
||||||
checkResponse(resp);
|
checkResponse(resp);
|
||||||
|
log.info("Record {} of type {} successful created.", rec.getName(), rec.getType());
|
||||||
return resp.getResult();
|
return resp.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +253,7 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
String endpoint = CfRequest.RECORD_DELETE.buildPath(zone.getId(), id);
|
String endpoint = CfRequest.RECORD_DELETE.buildPath(zone.getId(), id);
|
||||||
RecordSingleResponse resp = deleteRequest(endpoint);
|
RecordSingleResponse resp = deleteRequest(endpoint);
|
||||||
checkResponse(resp);
|
checkResponse(resp);
|
||||||
|
log.debug("Record {} successful deleted.", id);
|
||||||
return resp.getResult().getId().equals(id);
|
return resp.getResult().getId().equals(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +274,7 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
String endpoint = CfRequest.RECORD_UPDATE.buildPath(zone.getId(), rec.getId());
|
String endpoint = CfRequest.RECORD_UPDATE.buildPath(zone.getId(), rec.getId());
|
||||||
RecordSingleResponse resp = patchRequest(endpoint, rec);
|
RecordSingleResponse resp = patchRequest(endpoint, rec);
|
||||||
checkResponse(resp);
|
checkResponse(resp);
|
||||||
|
log.info("Record {} of type {} successful updated.", rec.getName(), rec.getType());
|
||||||
return resp.getResult();
|
return resp.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +283,7 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
* (SLD), if it exists.
|
* (SLD), if it exists.
|
||||||
*
|
*
|
||||||
* @param zone The zone in which the DNS record resides. It provides information about the domain.
|
* @param zone The zone in which the DNS record resides. It provides information about the domain.
|
||||||
* @param sld The second-level domain (SLD) of the fully qualified domain name (FQDN) for which
|
* @param sld Th.apache.hc.client5.http.impl.e second-level domain (SLD) of the fully qualified domain name (FQDN) for which
|
||||||
* the record is being deleted.
|
* the record is being deleted.
|
||||||
* @param recordTypes The type of the DNS record to be deleted (e.g., A, CNAME, TXT).
|
* @param recordTypes The type of the DNS record to be deleted (e.g., A, CNAME, TXT).
|
||||||
* @throws CloudflareApiException If an error occurs while interacting with the Cloudflare API.
|
* @throws CloudflareApiException If an error occurs while interacting with the Cloudflare API.
|
||||||
@@ -292,7 +295,7 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
try {
|
try {
|
||||||
RecordEntity rec = sldInfo(zone, sld, recordType);
|
RecordEntity rec = sldInfo(zone, sld, recordType);
|
||||||
recordDelete(zone, rec);
|
recordDelete(zone, rec);
|
||||||
log.debug("Record {} of type {} successful deleted.", fqdn, recordTypes);
|
log.info("Record {} of type {} successful deleted.", fqdn, recordTypes);
|
||||||
} catch (CloudflareNotFoundException e) {
|
} catch (CloudflareNotFoundException e) {
|
||||||
log.debug("Record {} of type {} does not exist.", fqdn, recordTypes);
|
log.debug("Record {} of type {} does not exist.", fqdn, recordTypes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration debug="false">
|
<configuration debug="true">
|
||||||
|
|
||||||
<appender name="current"
|
<appender name="current"
|
||||||
class="ch.qos.logback.core.ConsoleAppender">
|
class="ch.qos.logback.core.ConsoleAppender">
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<logger name="org.apache.hc.client5.http" level="info" />
|
||||||
|
|
||||||
<root level="debug">
|
<root level="debug">
|
||||||
<appender-ref ref="current"/>
|
<appender-ref ref="current"/>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user