Refactor logger message
authorTomasz Wrobel <tomasz.wrobel@nokia.com>
Tue, 3 Mar 2020 13:27:07 +0000 (14:27 +0100)
committerTomasz Wrobel <tomasz.wrobel@nokia.com>
Tue, 3 Mar 2020 13:27:07 +0000 (14:27 +0100)
Issue-ID: AAF-996
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: Ifc3ff60b8b5da15bdc904a80b6e80195b7bca0ce

certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/HttpClient.java

index abf3cb1..30f881b 100644 (file)
@@ -57,14 +57,14 @@ public class HttpClient {
             throws CertServiceApiResponseException, HttpClientException {
 
         try (CloseableHttpClient httpClient = httpClientProvider.getClient()) {
-            LOGGER.info(String.format("Sending request to API. Url: %s ", certServiceAddress + caName));
+            LOGGER.info("Sending request to API. Url: {}{} ", certServiceAddress, caName);
             HttpResponse httpResponse = httpClient.execute(createHttpRequest(caName, csr, encodedPk));
             LOGGER.info("Received response from API");
             return extractCertServiceResponse(httpResponse);
 
         } catch (IOException e) {
-            LOGGER.error(String.format("Failed execute request to API for URL: '%s' . Exception message: '%s'",
-                    certServiceAddress + caName, e.getMessage()));
+            LOGGER.error("Failed execute request to API for URL: {}{} . Exception message: {}",
+                    certServiceAddress, caName, e.getMessage());
             throw new HttpClientException(e);
         }
     }
@@ -77,7 +77,7 @@ public class HttpClient {
             throws CertServiceApiResponseException, HttpClientException {
         int httpResponseCode = getStatusCode(httpResponse);
         if (HttpStatus.SC_OK != httpResponseCode) {
-            LOGGER.error(String.format("Error on API response. Response Code: %d", httpResponseCode));
+            LOGGER.error("Error on API response. Response Code: {}", httpResponseCode);
             throw generateApiResponseException(httpResponse);
         }
         String jsonResponse = getStringResponse(httpResponse.getEntity());