aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSangalang, Felix <felix.sangalang@att.com>2019-08-29 09:59:30 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-08-29 14:13:45 -0400
commitf609b3b108d4b2d511ab55ebc36c9ae531215580 (patch)
treede6f465e4ee0fe995fafa12ad2ac09f075408b8a
parente709eab9ab55753eb17e435ee87f7f32d811bce2 (diff)
Added back MDC.put to generated missing requestID
Added back MDC.put to generated missing requestID in logfiles. Issue-ID: SO-2265 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I67e0b01dfeb609e7a5d7e29f976ec3ec6549e96b
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 251464a34d..6de22825b7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -37,8 +37,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,6 +52,9 @@ import org.springframework.stereotype.Component;
@Component
public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+
@Autowired
private LoggingParseListener loggingParseListener;
@@ -294,6 +299,13 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(SERVICE_INSTANCE_ID, svcid);
+ MDC.put(SERVICE_NAME, processName);
+ } catch (Exception e) {
+ logger.error("Error trying to add variables to MDC", e);
+ }
}
} catch (Exception e) {
logger.error("Exception occurred", e);