diff --git a/duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java b/duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java index ff2067b49a4d866e3dbe8b5a2c5dc1c0c387b844..4491bae080f5fcc967f1ada63197a273a9850ade 100644 --- a/duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java +++ b/duniter4j-core-client/src/main/java/org/duniter/core/client/service/HttpServiceImpl.java @@ -309,14 +309,14 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean HttpClientContext clientContext = HttpClientContext.adapt(context); HttpRequest request = clientContext.getRequest(); if (!retrying) { - log.debug("Failed request to " + request.getRequestLine() + ": " + exception.getMessage()); + if (debug) log.debug("Failed request to " + request.getRequestLine() + ": " + exception.getMessage()); return false; } boolean idempotent = !(request instanceof HttpEntityEnclosingRequest); if (idempotent) { // Retry if the request is considered idempotent - log.debug("Failed (but will retry) request to " + request.getRequestLine() + ": " + exception.getMessage()); + if (debug) log.debug("Failed (but will retry) request to " + request.getRequestLine() + ": " + exception.getMessage()); return true; } return false; @@ -429,7 +429,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean // HTTP requests limit exceed, retry when possible if (retry) { if (retryCount > 0) { - log.debug(String.format("Service unavailable: waiting [%s ms] before retrying...", Constants.Config.TOO_MANY_REQUEST_RETRY_TIME)); + if (debug) log.debug(String.format("Service unavailable: waiting [%s ms] before retrying...", Constants.Config.TOO_MANY_REQUEST_RETRY_TIME)); try { Thread.sleep(Constants.Config.TOO_MANY_REQUEST_RETRY_TIME); } catch (InterruptedException e) { @@ -464,7 +464,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean try { String stringContent = getContentAsString(content); // Add a debug before returning the result - if (log.isDebugEnabled()) { + if (debug) { log.debug("Parsing response:\n" + stringContent); } return stringContent; @@ -529,7 +529,7 @@ public class HttpServiceImpl implements HttpService, Closeable, InitializingBean protected boolean executeRequest(HttpClient httpClient, HttpUriRequest request) { - if (log.isDebugEnabled()) { + if (debug) { log.debug("Executing request : " + request.getRequestLine()); }