From 11e0afc41aa47b9b5fe36c6c654c5b7493e4ba46 Mon Sep 17 00:00:00 2001 From: "Magnusen, Drew (dm741q)" Date: Thu, 24 Aug 2017 11:37:46 -0500 Subject: Removal of sys.out/err with logger messages Removed any use of System.out.println or System.err.println and replaced with relevant logger statements. Issue-ID: POLICY-176 Change-Id: I91513267635bfb2a34f2a9650c48f367d53fc842 Signed-off-by: Magnusen, Drew (dm741q) --- .../main/java/org/onap/policy/rest/RESTManager.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'controlloop/common/model-impl/rest/src/main/java') diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java index c38c1076c..9ea480981 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java @@ -55,14 +55,14 @@ public final class RESTManager { CredentialsProvider credentials = new BasicCredentialsProvider(); credentials.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); - System.out.println("HTTP REQUEST: " + url + " -> " + username + ((password!=null)?password.length():"-") + " -> " + contentType); + logger.debug("HTTP REQUEST: {} -> {} {} -> {}", url, username, ((password!=null)?password.length():"-"), contentType); if (headers != null) { - System.out.println("Headers: "); + logger.debug("Headers: "); headers.forEach((name, value) -> { - System.out.println(name + " -> " + value); + logger.debug("{} -> {}", name, value); }); } - System.out.println(body); + logger.debug(body); try (CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentials).build()) { @@ -81,9 +81,9 @@ public final class RESTManager { HttpResponse response = client.execute(post); String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); - System.out.println("HTTP POST Response Status Code: " + response.getStatusLine().getStatusCode()); - System.out.println("HTTP POST Response Body:"); - System.out.println(returnBody); + logger.debug("HTTP POST Response Status Code: {}", response.getStatusLine().getStatusCode()); + logger.debug("HTTP POST Response Body:"); + logger.debug(returnBody); return new Pair(response.getStatusLine().getStatusCode(), returnBody); } catch (IOException e) { @@ -111,8 +111,10 @@ public final class RESTManager { HttpResponse response = client.execute(get); String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); - logger.debug("HTTP GET Response Status Code: " + response.getStatusLine().getStatusCode()); - logger.debug("HTTP GET Response Body: " + returnBody); + + logger.debug("HTTP GET Response Status Code: {}", response.getStatusLine().getStatusCode()); + logger.debug("HTTP GET Response Body:"); + logger.debug(returnBody); return new Pair(response.getStatusLine().getStatusCode(), returnBody); } catch (IOException e) { -- cgit 1.2.3-korg