changed pom version to 3.4 and changes to audit and error log. 91/112591/2
authorMuni Mohan Kunchi <munmohan@att.com>
Sun, 13 Sep 2020 21:46:23 +0000 (17:46 -0400)
committerMuni Mohan Kunchi <munmohan@att.com>
Tue, 15 Sep 2020 21:16:07 +0000 (17:16 -0400)
Issue-ID: PORTAL-1008

Signed-off-by: Muni Mohan Kunchi <munmohan@att.com>
Change-Id: Idb8b4cafe78c7dae42f6f9921a6a4a315f90641c

15 files changed:
ecomp-sdk/epsdk-aaf/pom.xml
ecomp-sdk/epsdk-analytics/pom.xml
ecomp-sdk/epsdk-app-common/pom.xml
ecomp-sdk/epsdk-app-os/pom.xml
ecomp-sdk/epsdk-app-overlay/pom.xml
ecomp-sdk/epsdk-core/pom.xml
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java
ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java
ecomp-sdk/epsdk-domain/pom.xml
ecomp-sdk/epsdk-fw/pom.xml
ecomp-sdk/epsdk-logger/pom.xml
ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java
ecomp-sdk/epsdk-music/pom.xml
ecomp-sdk/epsdk-workflow/pom.xml
ecomp-sdk/pom.xml

index 4423c33..1cf2dad 100644 (file)
@@ -7,12 +7,12 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        
        <groupId>org.onap.portal.sdk</groupId>
        <artifactId>epsdk-aaf</artifactId>
-       <version>3.3.0-SNAPSHOT</version>
+       <version>3.4.0-SNAPSHOT</version>
        <packaging>jar</packaging>
 
        <name>ONAP Portal SDK AAF Authorization</name>
index 768b7d8..8873d41 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        
        <!-- GroupId is inherited from parent -->
index 2af46dc..a2a7972 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <!-- GroupId is inherited from parent -->
index 7e07b3d..738ff57 100644 (file)
@@ -9,7 +9,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <!-- GroupId is inherited from parent -->
index 3e5a987..c89c72a 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <!-- GroupId is inherited from parent -->
index 753f0d8..f1a40ed 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <!-- GroupId is inherited from parent -->
index acd39d7..b1a0b0b 100644 (file)
@@ -112,7 +112,8 @@ public class AppConfig extends WebMvcConfigurerAdapter implements Configurable,
         * each log file type that logging has been started.
         */
        private void initGlobalLocalContext() {
-               logger.init();
+               String appName = SystemProperties.getProperty(SystemProperties.APPLICATION_NAME);
+               logger.init(appName);
        }
 
        /**
index b190c47..322e3c6 100644 (file)
@@ -241,7 +241,7 @@ public class EELFLoggerDelegateTest {
        @Test
        public void initTest(){
                EELFLoggerDelegate eelFLoggerDelegate = new EELFLoggerDelegate(getClass().getName());
-               eelFLoggerDelegate.init();
+               eelFLoggerDelegate.init(SystemProperties.getProperty(SystemProperties.APPLICATION_NAME));
                Assert.assertTrue(true);
        }
        
index 913087b..95061d1 100644 (file)
@@ -5,12 +5,12 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <groupId>org.onap.portal.sdk</groupId>
        <artifactId>epsdk-domain</artifactId>
-       <version>3.3.0-SNAPSHOT</version>
+       <version>3.4.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>ONAP Portal SDK Domain</name>
 
index be64ae2..a52c793 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <!-- GroupId is inherited from parent -->
index 1007e8a..e5a3a37 100644 (file)
@@ -4,12 +4,12 @@
   <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
   </parent>
   
   <groupId>org.onap.portal.sdk</groupId>
   <artifactId>epsdk-logger</artifactId>
-  <version>3.3.0-SNAPSHOT</version>
+  <version>3.4.0-SNAPSHOT</version>
 
         <name>ONAP Portal SDK Logger</name>
   
index 901c673..2bb1b52 100644 (file)
@@ -1,39 +1,39 @@
 /*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *             http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *             https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END============================================
- *
- 
+* ============LICENSE_START==========================================
+* ONAP Portal SDK
+* ===================================================================
+* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+* ===================================================================
+*
+* Unless otherwise specified, all software contained herein is licensed
+* under the Apache License, Version 2.0 (the "License");
+* you may not use this software except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Unless otherwise specified, all documentation contained herein is licensed
+* under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+* you may not use this documentation except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             https://creativecommons.org/licenses/by/4.0/
+*
+* Unless required by applicable law or agreed to in writing, documentation
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* ============LICENSE_END============================================
+*
+* 
  */
 package org.onap.portalsdk.core.logging.logic;
 
@@ -49,6 +49,8 @@ import java.net.InetAddress;
 import java.text.MessageFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -71,7 +73,6 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
        public static final EELFLogger applicationLogger = EELFManager.getInstance().getApplicationLogger();
        public static final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
        private static final SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
-               
 
        private String className;
        private static ConcurrentMap<String, EELFLoggerDelegate> classMap = new ConcurrentHashMap<String, EELFLoggerDelegate>();
@@ -97,8 +98,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * Gets a logger for the specified class name. If the logger does not already
         * exist in the map, this creates a new logger.
         * 
-        * @param className
-        *            If null or empty, uses EELFLoggerDelegate as the class name.
+        * @param className If null or empty, uses EELFLoggerDelegate as the class name.
         * @return Instance of EELFLoggerDelegate
         */
        public static EELFLoggerDelegate getLogger(final String className) {
@@ -112,6 +112,28 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
                return delegate;
        }
 
+       public static void logWrite(EELFLogger logger, Level level, String msg, Throwable th, Object... arguments) {
+
+               if ( logger == errorLogger) {
+                       MDC.put("ErrorCategory", ErrorSeverityEnum.ERROR.name());
+                       MDC.put("ErrorCode", "900");
+                       MDC.put("ErrorDescription", "Exception");
+               }
+               
+               if (logger.isErrorEnabled()) {
+                       logger.log(level, msg, null, arguments);
+               } else {
+                       logger.log(level, msg, th, arguments);
+               }
+               
+               if ( logger == errorLogger) {
+                       MDC.remove("ErrorCode");
+                       MDC.remove("ErrorDescription");
+                       MDC.remove("ErrorCategory");
+               }
+
+       }
+
        /**
         * Logs a message at the lowest level: trace.
         * 
@@ -119,11 +141,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param msg
         */
        public void trace(EELFLogger logger, String msg) {
-               if (logger.isTraceEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.trace(msg);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.TRACE, msg, null);
        }
 
        /**
@@ -134,11 +152,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param arguments
         */
        public void trace(EELFLogger logger, String msg, Object... arguments) {
-               if (logger.isTraceEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.trace(msg, arguments);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.TRACE, msg, null, arguments);
        }
 
        /**
@@ -149,11 +163,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param th
         */
        public void trace(EELFLogger logger, String msg, Throwable th) {
-               if (logger.isTraceEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.trace(msg, th);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.TRACE, msg, null, th);
        }
 
        /**
@@ -163,11 +173,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param msg
         */
        public void debug(EELFLogger logger, String msg) {
-               if (logger.isDebugEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.debug(msg);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.DEBUG, msg, null);
        }
 
        /**
@@ -178,11 +184,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param arguments
         */
        public void debug(EELFLogger logger, String msg, Object... arguments) {
-               if (logger.isDebugEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.debug(msg, arguments);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.DEBUG, msg, null, arguments);
        }
 
        /**
@@ -193,11 +195,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param th
         */
        public void debug(EELFLogger logger, String msg, Throwable th) {
-               if (logger.isDebugEnabled()) {
-                       MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-                       logger.debug(msg, th);
-                       MDC.remove(LoggerProperties.MDC_CLASS_NAME);
-               }
+               logWrite(logger, Level.DEBUG, msg, null, th);
        }
 
        /**
@@ -208,7 +206,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void info(EELFLogger logger, String msg) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.info(msg);
+               logWrite(logger, Level.INFO, msg, null);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -221,8 +219,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void info(EELFLogger logger, String msg, Object... arguments) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.info(msg, arguments);
+               logWrite(logger, Level.INFO, msg, null, arguments);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
+
        }
 
        /**
@@ -234,8 +233,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void info(EELFLogger logger, String msg, Throwable th) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.info(msg, th);
+               logWrite(logger, Level.INFO, msg, null, th);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
+
        }
 
        /**
@@ -246,7 +246,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void warn(EELFLogger logger, String msg) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.warn(msg);
+               logWrite(logger, Level.WARN, msg, null);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -259,7 +259,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void warn(EELFLogger logger, String msg, Object... arguments) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.warn(msg, arguments);
+               logWrite(logger, Level.WARN, msg, null, arguments);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -272,7 +272,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void warn(EELFLogger logger, String msg, Throwable th) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.warn(msg, th);
+               logWrite(logger, Level.WARN, msg, null, th);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -284,7 +284,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void error(EELFLogger logger, String msg) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.error(msg);
+               logWrite(logger, Level.ERROR, msg, null);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -297,7 +297,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void error(EELFLogger logger, String msg, Object... arguments) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.error(msg, arguments);
+               logWrite(logger, Level.ERROR, msg, null, arguments);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -310,7 +310,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         */
        public void error(EELFLogger logger, String msg, Throwable th) {
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.error(msg, th);
+               logWrite(logger, Level.ERROR, msg, null);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
        }
 
@@ -324,44 +324,24 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
        public void error(EELFLogger logger, String msg, AlarmSeverityEnum severtiy) {
                MDC.put(MDC_ALERT_SEVERITY, severtiy.name());
                MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
-               logger.error(msg);
-               MDC.remove(MDC_ALERT_SEVERITY);
+               logWrite(logger, Level.ERROR, msg, null);
                MDC.remove(LoggerProperties.MDC_CLASS_NAME);
+               MDC.remove(MDC_ALERT_SEVERITY);
        }
 
        /**
         * Initializes the logger context.
         */
-       public void init() {
+       public void init(String appName) {
                setGlobalLoggingContext();
-               final String msg = "############################ Logging is started. ############################";
-               // These loggers emit the current date-time without being told.
-               info(applicationLogger, msg);
-               error(errorLogger, msg);
-               debug(debugLogger, msg);
-               // Audit and metrics logger must be told start AND stop times
-               final String currentDateTime = getCurrentDateTimeUTC();
-               // Set the MDC with audit properties
-               MDC.put(LoggerProperties.AUDITLOG_BEGIN_TIMESTAMP, currentDateTime);
-               MDC.put(LoggerProperties.AUDITLOG_END_TIMESTAMP, currentDateTime);
-               info(auditLogger, msg);
-               MDC.remove(LoggerProperties.AUDITLOG_BEGIN_TIMESTAMP);
-               MDC.remove(LoggerProperties.AUDITLOG_END_TIMESTAMP);
-               // Set the MDC with metrics properties
-               MDC.put(LoggerProperties.METRICSLOG_BEGIN_TIMESTAMP, currentDateTime);
-               MDC.put(LoggerProperties.METRICSLOG_END_TIMESTAMP, currentDateTime);
-               info(metricsLogger, msg);
-               MDC.remove(LoggerProperties.METRICSLOG_BEGIN_TIMESTAMP);
-               MDC.remove(LoggerProperties.METRICSLOG_END_TIMESTAMP);
+               MDC.put(MDC_SERVICE_NAME, appName);
        }
-       
-       
+
        public static String getCurrentDateTimeUTC() {
                String currentDateTime = ecompLogDateFormat.format(new Date());
                return currentDateTime;
        }
 
-
        /**
         * Logs a standard message identified by the specified enum, using the specified
         * parameters, at error level. Alarm and error severity are taken from the
@@ -451,60 +431,56 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
         * @param req
         * @param appName
         */
-       public void setRequestBasedDefaultsIntoGlobalLoggingContext(HttpServletRequest req, String appName,String reqId,String loginId) {// Load the default fields
+       public void setRequestBasedDefaultsIntoGlobalLoggingContext(HttpServletRequest req, String appName, String reqId,
+                       String loginId) {// Load the default fields
                // Load the default fields
-                               setGlobalLoggingContext();
-
-                               // Load the request based fields
-                               if (req != null) {
-                                       // Load the Request into MDC context.
-                                       
-                                       MDC.put(MDC_KEY_REQUEST_ID, reqId);
-
-                                       // Load user agent into MDC context, if available.
-                                       String accessingClient = req.getHeader(LoggerProperties.USERAGENT_NAME);
-                                       if (accessingClient != null && !"".equals(accessingClient) && (accessingClient.contains("Mozilla")
-                                                       || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) {
-                                               accessingClient = appName + "_FE";
-                                       }
-                                       MDC.put(LoggerProperties.PARTNER_NAME, accessingClient);
-
-                                       // Protocol, Rest URL & Rest Path
-                                       MDC.put(LoggerProperties.FULL_URL, LoggerProperties.UNKNOWN);
-                                       MDC.put(LoggerProperties.PROTOCOL, LoggerProperties.HTTP);
-                                       String restURL = getFullURL(req);
-                                       if (restURL != null && restURL != "") {
-                                               MDC.put(LoggerProperties.FULL_URL, restURL);
-                                               if (restURL.toLowerCase().contains("https")) {
-                                                       MDC.put(LoggerProperties.PROTOCOL, LoggerProperties.HTTPS);
-                                               }
-                                       }
-
-                                       // Rest Path
-                                       MDC.put(MDC_SERVICE_NAME, req.getServletPath());
-
-                                       // Client IPAddress i.e. IPAddress of the remote host who is making
-                                       // this request.
-                                       String clientIPAddress = req.getHeader("X-FORWARDED-FOR");
-                                       if (clientIPAddress == null) {
-                                               clientIPAddress = req.getRemoteAddr();
-                                       }
-                                       MDC.put(LoggerProperties.CLIENT_IP_ADDRESS, clientIPAddress);
-
-                                       // Load loginId into MDC context.
-                                       MDC.put(LoggerProperties.MDC_LOGIN_ID, "Unknown");
-
-                               
-
-                                       if (loginId != null && loginId != "") {
-                                               MDC.put(LoggerProperties.MDC_LOGIN_ID, loginId);
-                                       }
+               setGlobalLoggingContext();
+
+               // Load the request based fields
+               if (req != null) {
+                       // Load the Request into MDC context.
+
+                       MDC.put(MDC_KEY_REQUEST_ID, reqId);
+
+                       // Load user agent into MDC context, if available.
+                       String accessingClient = req.getHeader(LoggerProperties.USERAGENT_NAME);
+                       if (accessingClient != null && !"".equals(accessingClient) && (accessingClient.contains("Mozilla")
+                                       || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) {
+                               accessingClient = appName + "_FE";
+                       }
+                       MDC.put(LoggerProperties.PARTNER_NAME, accessingClient);
+
+                       // Protocol, Rest URL & Rest Path
+                       MDC.put(LoggerProperties.FULL_URL, LoggerProperties.UNKNOWN);
+                       MDC.put(LoggerProperties.PROTOCOL, LoggerProperties.HTTP);
+                       String restURL = getFullURL(req);
+                       if (restURL != null && restURL != "") {
+                               MDC.put(LoggerProperties.FULL_URL, restURL);
+                               if (restURL.toLowerCase().contains("https")) {
+                                       MDC.put(LoggerProperties.PROTOCOL, LoggerProperties.HTTPS);
                                }
+                       }
+
+                       // Rest Path
+                       MDC.put(MDC_SERVICE_NAME, req.getServletPath());
+
+                       // Client IPAddress i.e. IPAddress of the remote host who is making
+                       // this request.
+                       String clientIPAddress = req.getHeader("X-FORWARDED-FOR");
+                       if (clientIPAddress == null) {
+                               clientIPAddress = req.getRemoteAddr();
+                       }
+                       MDC.put(LoggerProperties.CLIENT_IP_ADDRESS, clientIPAddress);
+
+                       // Load loginId into MDC context.
+                       MDC.put(LoggerProperties.MDC_LOGIN_ID, "Unknown");
+
+                       if (loginId != null && loginId != "") {
+                               MDC.put(LoggerProperties.MDC_LOGIN_ID, loginId);
+                       }
+               }
        }
-       
 
-       
-       
        public static String getFullURL(HttpServletRequest request) {
                if (request != null) {
                        StringBuffer requestURL = request.getRequestURL();
index f7de89e..553dcf8 100644 (file)
@@ -5,12 +5,12 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        
        <groupId>org.onap.portal.sdk</groupId>
        <artifactId>epsdk-music</artifactId>
-       <version>3.3.0-SNAPSHOT</version>
+       <version>3.4.0-SNAPSHOT</version>
        <packaging>jar</packaging>
 
        <name>ONAP Portal SDK Music</name>
index 00b7862..4bc5bae 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal.sdk</groupId>
                <artifactId>epsdk-project</artifactId>
-               <version>3.3.0-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        
        <!-- GroupId is inherited from parent -->
index 2c16ed1..d65b84a 100644 (file)
@@ -13,7 +13,7 @@
        <!-- Portal SDK Maven parent project -->
        <groupId>org.onap.portal.sdk</groupId>
        <artifactId>epsdk-project</artifactId>
-       <version>3.3.0-SNAPSHOT</version>
+       <version>3.4.0-SNAPSHOT</version>
        <packaging>pom</packaging>
        <name>portal-sdk</name>
        <url>https://wiki.onap.org/display/DW/Portal</url>