summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2020-04-29 15:28:15 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-29 15:28:16 -0400
commit8973da059db915ad30d4a85797ed23a6df3801c8 (patch)
treec632ff08fe325c9e147178da452ecd29d1e2ac94
parent37a2d93feb1dc910e7b09443369083fd49766f89 (diff)
improve logging scores
Replaced newlines in error message Added setting elapsedTime in SOAPLoggingOutInterceptor Issue-ID: SO-2851 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I55033eb8575519f42f3458254ea5e37db99725d0
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java4
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml2
2 files changed, 5 insertions, 1 deletions
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index 3785d3165f..a03637831a 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -26,6 +26,7 @@ import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
+import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,6 +49,7 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor {
@Override
public void handleMessage(SoapMessage message) throws Fault {
try {
+ MDCSetup mdcSetup = new MDCSetup();
Exception ex = message.getContent(Exception.class);
if (ex == null) {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE,
@@ -62,6 +64,8 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
}
+ mdcSetup.setLogTimestamp();
+ mdcSetup.setElapsedTime();
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} catch (Exception e) {
logger.warn("Error in incoming SOAP Message Inteceptor", e);
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
index 0e8d0a8222..258382b834 100644
--- a/deployment-configs/src/main/resources/logger/logback-spring.xml
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -27,7 +27,7 @@
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%msg%nopex%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%replace(%msg){'\n',' '}%nopex%n" />
<property name="debugPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />