diff options
Diffstat (limited to 'common/src/main/java/org/onap/so/logging/spring')
-rw-r--r-- | common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java index 4084ad3ff0..eeb8593725 100644 --- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java +++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java @@ -30,6 +30,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.ext.Providers; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.LogConstants; import org.onap.so.logging.jaxrs.filter.MDCSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,6 +61,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { setRequestId(headers); setInvocationId(headers); setServiceName(request); + setHttpUrl(request); setMDCPartnerName(headers); mdcSetup.setClientIPAddress(request); mdcSetup.setEntryTimeStamp(); @@ -109,7 +111,15 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { protected void setServiceName(HttpServletRequest request) { MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); } - + + protected void setHttpUrl(HttpServletRequest request) { + String queryParams = ""; + if (request.getQueryString() != null) { + queryParams = "?" + request.getQueryString(); + } + MDC.put(LogConstants.HTTP_URL, request.getRequestURL() + queryParams); + } + protected void setRequestId(Map<String, String> headers) { String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase()); if(requestId == null || requestId.isEmpty()) |