From f609b3b108d4b2d511ab55ebc36c9ae531215580 Mon Sep 17 00:00:00 2001 From: "Sangalang, Felix" Date: Thu, 29 Aug 2019 09:59:30 -0400 Subject: 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) Change-Id: I67e0b01dfeb609e7a5d7e29f976ec3ec6549e96b --- .../so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bpmn/mso-infrastructure-bpmn') 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); -- cgit 1.2.3-korg