diff options
Diffstat (limited to 'prh-dmaap-client/src')
-rw-r--r-- | prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java | 9 |
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); }); } |