summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-command-executor
diff options
context:
space:
mode:
authorvidhyasree <sn141y@att.com>2018-06-21 16:33:20 -0400
committerTakamune Cho <tc012c@att.com>2018-06-22 17:59:26 +0000
commit057c89a2d1db077fa2238c02f998e4dbe9c47268 (patch)
tree7a7c3e52ec3fdc2bf783630e614e65d8544b54b7 /appc-dispatcher/appc-command-executor
parentdc093f5f5cde53fb427712095f88bcebf225c599 (diff)
Shore up Logging Score on DGs
Modify TopologyService and DG calls to have all logging fields Issue-ID: APPC-1020 Change-Id: I60078960ed0cfa8c70d0f4673c6d4a5026afc673 Signed-off-by: vidhyasree <sn141y@att.com>
Diffstat (limited to 'appc-dispatcher/appc-command-executor')
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
index 0784ffcbe..965664429 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
@@ -45,6 +45,7 @@ import org.osgi.framework.ServiceReference;
import org.slf4j.MDC;
import java.net.InetAddress;
+import java.util.UUID;
import static com.att.eelf.configuration.Configuration.*;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
@@ -169,7 +170,17 @@ public class CommandTask implements Runnable {
private void setInitialLogProperties(CommandRequest request) {
- MDC.put(MDC_KEY_REQUEST_ID, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getRequestId());
+ String reqId = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getRequestId();
+
+ try {
+ MDC.put(MDC_KEY_REQUEST_ID, UUID.fromString(reqId).toString());
+ //reaching here without exception means existing RequestId is
+ //valid UUID as per ECOMP logging standards
+ } catch (Exception e) {
+ String reqIdUUID = UUID.randomUUID().toString();
+ MDC.put(MDC_KEY_REQUEST_ID, reqIdUUID);
+ logger.info("Replaced invalid requestID of " + reqId + ". New value is " + reqIdUUID + ".");
+ }
if (request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getActionIdentifiers().getServiceInstanceId() != null)
MDC.put(MDC_SERVICE_INSTANCE_ID, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getActionIdentifiers().getServiceInstanceId());
MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getOriginatorId());