summaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/main/java
diff options
context:
space:
mode:
authormicdzied <michal.1.dziedzic@nokia.com>2018-09-04 11:24:53 +0200
committermicdzied <michal.1.dziedzic@nokia.com>2018-09-04 12:11:12 +0200
commitc22f8a49db802a8087b6e05318db766be7e141fd (patch)
tree3a39806aec3f4cc1f29b535b2a7b445a503cebe4 /prh-dmaap-client/src/main/java
parentbe3127220aed103d1c1bb495080d62593d61b835 (diff)
MDC fix
Change-Id: I4b12f9b9914d93ee2969b4b3cf48a47837330a6d Issue-ID: DCAEGEN2-745 Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/main/java')
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
index d34728ce..242a4251 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
@@ -20,6 +20,9 @@
package org.onap.dcaegen2.services.prh.service;
+import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.RESPONSE_CODE;
+import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.SERVICE_NAME;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -48,18 +51,20 @@ public class DMaaPReactiveWebClient {
private ExchangeFilterFunction logResponse() {
return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
- MDC.put("ResponseCode", String.valueOf(clientResponse.statusCode()));
+ MDC.put(RESPONSE_CODE, String.valueOf(clientResponse.statusCode()));
logger.info("Response Status {}", clientResponse.statusCode());
+ MDC.remove(RESPONSE_CODE);
return Mono.just(clientResponse);
});
}
private ExchangeFilterFunction logRequest() {
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
- MDC.put("ServiceName", String.valueOf(clientRequest.url()));
+ MDC.put(SERVICE_NAME, String.valueOf(clientRequest.url()));
logger.info("Request: {} {}", clientRequest.method(), clientRequest.url());
clientRequest.headers()
.forEach((name, values) -> values.forEach(value -> logger.info("{}={}", name, value)));
+ MDC.remove(SERVICE_NAME);
return Mono.just(clientRequest);
});
}