aboutsummaryrefslogtreecommitdiffstats
path: root/cxf-logging/src/main/java
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2020-05-11 14:25:19 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-05-11 14:25:20 -0400
commit195760a93887a3b7a3e3a6b9fd997d9ec8f9bb01 (patch)
tree047a49d63a0952eb209be9d491e7f7e56f291913 /cxf-logging/src/main/java
parent4bbcf0d74967a5af6c2cb874d262e45694202be7 (diff)
requestid values have commas audit log
Removed overwriting header with random uuid Removed setting of duplicate headers, updated SOAP logging Re-added setting non-duplicate header Updated version of logging library to get elapsedTime changes Fixed failing unit tests in MSOCommonBPMN Issue-ID: SO-2916 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I6b30d69daf210dd903e6a1c1d832de49bf8119d5
Diffstat (limited to 'cxf-logging/src/main/java')
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java7
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java74
2 files changed, 5 insertions, 76 deletions
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index d1f509f476..1e1c8a7de1 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -31,6 +31,7 @@ import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,7 +49,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
@Override
public void handleMessage(SoapMessage message) throws Fault {
try {
- SOAPMDCSetup mdcSetup = new SOAPMDCSetup();
+ MDCSetup mdcSetup = new MDCSetup();
Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
@@ -59,8 +60,10 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
setMDCPartnerName(headers);
mdcSetup.setServerFQDN();
mdcSetup.setClientIPAddress(request);
- mdcSetup.setInstanceUUID();
+ mdcSetup.setInstanceID();
mdcSetup.setEntryTimeStamp();
+ mdcSetup.setLogTimestamp();
+ mdcSetup.setElapsedTime();
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS");
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
} catch (Exception e) {
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
deleted file mode 100644
index 8258ce6f99..0000000000
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
- *
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logging.cxf.interceptor;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-
-
-public class SOAPMDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class);
-
- private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID() {
- MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
- }
-
- public void setServerFQDN() {
- String serverFQDN = "";
- InetAddress addr = null;
- try {
- addr = InetAddress.getLocalHost();
- serverFQDN = addr.toString();
- } catch (UnknownHostException e) {
- logger.warn("Cannot Resolve Host Name");
- serverFQDN = "";
- }
- MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
- }
-
- public void setClientIPAddress(HttpServletRequest httpServletRequest) {
- String remoteIpAddress = "";
- if (httpServletRequest != null) {
- remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
- MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
- }
-
- public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- }
-
-
-}