diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-11 20:57:10 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-11 20:57:24 -0500 |
commit | 82d7dbd9d08c77b0fecf1b47393d50d81760e758 (patch) | |
tree | 0da52c19f28ddbb90aa7330dbe7f58135848dbc8 /common/src/main | |
parent | de5958dddd97b086ec8b603974f434fd814386ac (diff) |
updated logging to JaxRsFilterLogging
Changed the MDC sourcing from LoggingInterceptor to JaxRsFilterLogging.
Change-Id: Idd807f1bf6d3a5a680f547d09503a53a362cd5d1
Issue-ID: SO-1362
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/main')
3 files changed, 3 insertions, 9 deletions
diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java index 2639adf304..3c8b7f7d56 100644 --- a/common/src/main/java/org/onap/so/logger/LogConstants.java +++ b/common/src/main/java/org/onap/so/logger/LogConstants.java @@ -24,4 +24,5 @@ public class LogConstants { public static final String TARGET_ENTITY_HEADER="X-Target-Entity"; public static final String UNKNOWN_TARGET_ENTITY="Unknown-Target-Entity"; public static final String HTTP_URL="Http-Url"; + public static final String URI_BASE="Uri-Base"; } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index 85a6498748..7a99594d19 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -40,6 +40,7 @@ import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.LogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -77,6 +78,7 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo mdcSetup.setInstanceUUID(); mdcSetup.setEntryTimeStamp(); MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString()); logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); } catch (Exception e) { logger.warn("Error in incoming JAX-RS Inteceptor", e); 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 eeb8593725..9aa4e4c9b5 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 @@ -61,7 +61,6 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { setRequestId(headers); setInvocationId(headers); setServiceName(request); - setHttpUrl(request); setMDCPartnerName(headers); mdcSetup.setClientIPAddress(request); mdcSetup.setEntryTimeStamp(); @@ -112,14 +111,6 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { 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()) |