diff options
author | Dan Timoney <dtimoney@att.com> | 2018-12-11 15:07:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-11 15:07:02 +0000 |
commit | d1cd3c2fc3df0b21263928058a332208942eff18 (patch) | |
tree | 476bf9a36a563295bc38efdd5e2c2e3a405b1c41 | |
parent | 6046453d92e74e6dbcb2345bfd3b9df977a044cd (diff) | |
parent | 3391f0dd1a9fc05e8529fda806dd48504c9510bd (diff) |
Merge "fixed sonar issues in LogFilter.java"
-rw-r--r-- | filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java index d7a599cb3..4481ab904 100644 --- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java +++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -84,6 +86,7 @@ public class LogFilter implements Filter { private static final Logger AUDIT = LoggerFactory.getLogger("org.onap.ccsdk.sli.core.filters.audit"); @Override public void destroy() { + // this method does nothing } @Override @@ -111,6 +114,7 @@ public class LogFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { + // this method does nothing } @@ -134,11 +138,7 @@ public class LogFilter implements Filter { String userName="unknown"; - /* below returning org.opendaylight.aaa.shiro.realm.TokenAuthRealm$ODLPrincipal@745dfcfe - if ( request.getUserPrincipal() != null) { - userName = request.getUserPrincipal().getName(); - } - */ + // going directly after Authorization header if (request.getHeader("Authorization") != null) { String authzHeader = request.getHeader("Authorization"); @@ -164,12 +164,8 @@ public class LogFilter implements Filter { private void post(HttpServletRequest request,HttpServletResponse response,long startTime) { - //AUDIT.info("{}|{}|{}{}",request.getRemoteHost(),request.getMethod(),request.getRequestURL().toString(),request.getQueryString()); - //AUDIT.info(request.getRemoteHost() + D + request.getMethod() + D + request.getRequestURL().toString() + D + request.getQueryString()); - //METRIC.info(request.getMethod() + D + response.getStatus() + D + request.getRequestURL().toString() + D + (System.currentTimeMillis() - startTime) + " ms"); MDC.put(BEGIN_TIMESTAMP,asIso8601(startTime)); MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis())); - //MDC.put(REQUEST_ID,"already done above"); MDC.put(SERVICE_NAME,request.getRequestURL().toString()); int idx = request.getPathInfo().lastIndexOf(':'); String instance = ""; @@ -179,7 +175,6 @@ public class LogFilter implements Filter { MDC.put(SERVICE_INSTANCE,instance); MDC.put(THREAD_ID,""); MDC.put(PHYSICAL_SERVER_NAME,""); - //MDC.put(PARTNER_NAME,"already done above"); if ( response.getStatus() >= 400 ) { MDC.put(STATUS_CODE,"ERROR"); } else { |