diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-09-15 05:14:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-09-15 05:14:23 +0000 |
commit | f705e6aaeda60c610c88ec840eb9f351981bff7a (patch) | |
tree | 78531fe34d6e82235654fc621af3b4308a84e84d /vid-app-common/src/main/java/org/onap | |
parent | ba2bdddc0f2f990bc07325e9a512a0a0c93c08af (diff) | |
parent | c729cb1356a3bacead0d9d63920c889966f64bdd (diff) |
Merge "logging of HttpResponse use raw body"
Diffstat (limited to 'vid-app-common/src/main/java/org/onap')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/utils/Logging.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java b/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java index 77b7ee869..0d8e58878 100644 --- a/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java +++ b/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java @@ -31,11 +31,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.common.collect.ImmutableList; import io.joshworks.restclient.http.HttpResponse; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Optional; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SystemProperties; @@ -123,7 +125,9 @@ public class Logging { public <T> void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final HttpResponse<T> response) { try { - logger.debug("Received {} {} Status: {} . Body: {}", method.name(), url, response.getStatus(), response.getBody()); + logger.debug("Received {} {} Status: {} . Body: {}", method.name(), + url, response.getStatus(), IOUtils.toString(response.getRawBody(), StandardCharsets.UTF_8)); + response.getRawBody().reset(); } catch (Exception e) { logger.debug("Received {} {} Status: {} . Failed to read response", method.name(), url, response.getStatus()); |