oozie-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject git commit: OOZIE-1939 Incorrect job information is set while logging (seoeun25 via shwethags)
Date Mon, 18 Aug 2014 06:25:48 GMT
Repository: oozie
Updated Branches:
  refs/heads/master 94306b4dc -> fa2a205be


OOZIE-1939 Incorrect job information is set while logging (seoeun25 via shwethags)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/fa2a205b
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/fa2a205b
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/fa2a205b

Branch: refs/heads/master
Commit: fa2a205be9c63867fd35903ff9bfceb65c632912
Parents: 94306b4
Author: Shwetha GS <shwetha.gs@inmobi.com>
Authored: Mon Aug 18 11:54:13 2014 +0530
Committer: Shwetha GS <shwetha.gs@inmobi.com>
Committed: Mon Aug 18 11:54:13 2014 +0530

----------------------------------------------------------------------
 .../oozie/action/hadoop/JavaActionExecutor.java |   6 +-
 .../java/org/apache/oozie/command/XCommand.java |  11 +-
 .../command/bundle/BundleJobChangeXCommand.java |   2 +-
 .../command/bundle/BundleJobResumeXCommand.java |   2 +-
 .../bundle/BundleJobSuspendXCommand.java        |   2 +-
 .../command/bundle/BundleKillXCommand.java      |   2 +-
 .../command/bundle/BundlePauseXCommand.java     |   2 +-
 .../command/bundle/BundleRerunXCommand.java     |   2 +-
 .../command/bundle/BundleStartXCommand.java     |   2 +-
 .../command/bundle/BundleSubmitXCommand.java    |   2 +-
 .../command/bundle/BundleUnpauseXCommand.java   |   2 +-
 .../command/coord/CoordActionCheckXCommand.java |   9 +-
 .../coord/CoordActionInputCheckXCommand.java    |   7 +-
 .../coord/CoordActionNotificationXCommand.java  |   7 +-
 .../command/coord/CoordActionReadyXCommand.java |   7 +-
 .../command/coord/CoordActionSkipXCommand.java  |   7 +-
 .../command/coord/CoordActionStartXCommand.java |   9 +-
 .../coord/CoordActionTimeOutXCommand.java       |   7 +-
 .../coord/CoordActionUpdateXCommand.java        |   7 +-
 .../coord/CoordActionsIgnoreXCommand.java       |   2 +-
 .../command/coord/CoordActionsKillXCommand.java |   2 +-
 .../command/coord/CoordChangeXCommand.java      |   7 +-
 .../oozie/command/coord/CoordKillXCommand.java  |   2 +-
 .../CoordMaterializeTransitionXCommand.java     |   2 +-
 .../oozie/command/coord/CoordPauseXCommand.java |   2 +-
 .../coord/CoordPushDependencyCheckXCommand.java |   7 +-
 .../oozie/command/coord/CoordRerunXCommand.java |   2 +-
 .../command/coord/CoordResumeXCommand.java      |   3 +-
 .../command/coord/CoordSubmitXCommand.java      |   6 +-
 .../command/coord/CoordSuspendXCommand.java     |   2 +-
 .../command/coord/CoordUnpauseXCommand.java     |   2 +-
 .../command/coord/CoordUpdateXCommand.java      |   2 +-
 .../oozie/command/wf/ActionCheckXCommand.java   |  13 ++-
 .../oozie/command/wf/ActionEndXCommand.java     |   9 +-
 .../oozie/command/wf/ActionKillXCommand.java    |   9 +-
 .../oozie/command/wf/ActionStartXCommand.java   |   9 +-
 .../apache/oozie/command/wf/ActionXCommand.java |   1 +
 .../command/wf/CompletedActionXCommand.java     |   7 +-
 .../oozie/command/wf/DefinitionXCommand.java    |   7 +-
 .../apache/oozie/command/wf/KillXCommand.java   |   7 +-
 .../oozie/command/wf/NotificationXCommand.java  |  13 ++-
 .../apache/oozie/command/wf/ReRunXCommand.java  |   7 +-
 .../apache/oozie/command/wf/ResumeXCommand.java |   7 +-
 .../apache/oozie/command/wf/SignalXCommand.java |  15 ++-
 .../oozie/command/wf/SubmitHttpXCommand.java    |   2 +-
 .../apache/oozie/command/wf/SubmitXCommand.java |   3 +-
 .../oozie/command/wf/SuspendXCommand.java       |   8 +-
 .../oozie/service/CallableQueueService.java     |  12 +-
 .../oozie/service/EventHandlerService.java      |   1 -
 .../apache/oozie/servlet/CallbackServlet.java   |  20 +---
 .../apache/oozie/servlet/HostnameFilter.java    |   1 +
 .../apache/oozie/servlet/JsonRestServlet.java   |  11 +-
 .../java/org/apache/oozie/util/LogUtils.java    | 109 +++++++++----------
 .../main/java/org/apache/oozie/util/XLog.java   |  54 +++------
 .../java/org/apache/oozie/util/TestXLog.java    |  68 +++++++++++-
 release-log.txt                                 |   1 +
 56 files changed, 331 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index 7f4d473..d6b918c 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -1123,8 +1123,7 @@ public class JavaActionExecutor extends ActionExecutor {
 
     @Override
     public void start(Context context, WorkflowAction action) throws ActionExecutorException {
-        LOG = XLog.resetPrefix(LOG);
-        LogUtils.setLogInfo(action, new XLog.Info());
+        LogUtils.setLogInfo(action);
         try {
             LOG.debug("Starting action " + action.getId() + " getting Action File System");
             FileSystem actionFs = context.getAppFileSystem();
@@ -1186,8 +1185,7 @@ public class JavaActionExecutor extends ActionExecutor {
     public void check(Context context, WorkflowAction action) throws ActionExecutorException {
         JobClient jobClient = null;
         boolean exception = false;
-        LOG = XLog.resetPrefix(LOG);
-        LogUtils.setLogInfo(action, new XLog.Info());
+        LogUtils.setLogInfo(action);
         try {
             Element actionXml = XmlUtils.parseXml(action.getConf());
             FileSystem actionFs = context.getAppFileSystem();

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/XCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/XCommand.java b/core/src/main/java/org/apache/oozie/command/XCommand.java
index 44e1133..7f73a1e 100644
--- a/core/src/main/java/org/apache/oozie/command/XCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/XCommand.java
@@ -78,7 +78,6 @@ public abstract class XCommand<T> implements XCallable<T> {
     protected boolean dryrun = false;
     protected Instrumentation instrumentation;
 
-    protected XLog.Info logInfo;
     protected static EventHandlerService eventService;
 
     /**
@@ -94,7 +93,6 @@ public abstract class XCommand<T> implements XCallable<T> {
         this.priority = priority;
         this.key = name + "_" + UUID.randomUUID();
         createdTime = System.currentTimeMillis();
-        logInfo = new XLog.Info();
         instrumentation = Services.get().get(InstrumentationService.class).get();
         eventService = Services.get().get(EventHandlerService.class);
     }
@@ -112,6 +110,12 @@ public abstract class XCommand<T> implements XCallable<T> {
     }
 
     /**
+     * Set the thread local logInfo with the context of this command and reset log prefix.
+     */
+    protected void setLogInfo() {
+    }
+
+    /**
      * Return the command name.
      *
      * @return the command name.
@@ -235,6 +239,7 @@ public abstract class XCommand<T> implements XCallable<T> {
      */
     @Override
     public final T call() throws CommandException {
+        setLogInfo();
         if (CallableQueueService.INTERRUPT_TYPES.contains(this.getType()) && used.get()) {
             LOG.debug("Command [{0}] key [{1}]  already used for [{2}]", getName(), getEntityKey(), this.toString());
             return null;
@@ -247,7 +252,6 @@ public abstract class XCommand<T> implements XCallable<T> {
             callCron.start();
             if (!isSynchronous) {
                 eagerLoadState();
-                LOG = XLog.resetPrefix(LOG);
                 eagerVerifyPrecondition();
             }
             try {
@@ -272,7 +276,6 @@ public abstract class XCommand<T> implements XCallable<T> {
                     }
                     LOG.trace("Load state for [{0}]", getEntityKey());
                     loadState();
-                    LOG = XLog.resetPrefix(LOG);
                     LOG.trace("Precondition check for command [{0}] key [{1}]", getName(), getEntityKey());
                     verifyPrecondition();
                     LOG.debug("Execute command [{0}] key [{1}]", getName(), getEntityKey());

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
index 41ad8ae..7e9ea32 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
@@ -245,7 +245,7 @@ public class BundleJobChangeXCommand extends XCommand<Void> {
     protected void eagerLoadState() throws CommandException {
         try {
             this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, jobId);
-            LogUtils.setLogInfo(bundleJob, logInfo);
+            LogUtils.setLogInfo(bundleJob);
         }
         catch (JPAExecutorException ex) {
             throw new CommandException(ex);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
index 8ccab0e..6384ddf 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
@@ -166,7 +166,7 @@ public class BundleJobResumeXCommand extends ResumeTransitionXCommand {
             throw new CommandException(ErrorCode.E0604, bundleId);
         }
 
-        LogUtils.setLogInfo(bundleJob, logInfo);
+        LogUtils.setLogInfo(bundleJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
index 65eb272..cb17192 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
@@ -120,7 +120,7 @@ public class BundleJobSuspendXCommand extends SuspendTransitionXCommand {
             throw new CommandException(ErrorCode.E1311, jobId);
         }
 
-        LogUtils.setLogInfo(bundleJob, logInfo);
+        LogUtils.setLogInfo(bundleJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
index c101f45..be8faba 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
@@ -73,7 +73,7 @@ public class BundleKillXCommand extends KillTransitionXCommand {
             this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, jobId);
             this.bundleActions = BundleActionQueryExecutor.getInstance().getList(
                     BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, jobId);
-            LogUtils.setLogInfo(bundleJob, logInfo);
+            LogUtils.setLogInfo(bundleJob);
             super.setJob(bundleJob);
 
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
index 0a04a02..52e6335 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
@@ -56,7 +56,7 @@ public class BundlePauseXCommand extends PauseTransitionXCommand {
      */
     @Override
     public void loadState() throws CommandException {
-        LogUtils.setLogInfo(bundleJob, logInfo);
+        LogUtils.setLogInfo(bundleJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
index f5f4b3f..2d7cf88 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
@@ -89,7 +89,7 @@ public class BundleRerunXCommand extends RerunTransitionXCommand<Void> {
             this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, jobId);
             this.bundleActions = BundleActionQueryExecutor.getInstance().getList(
                     BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, jobId);
-            LogUtils.setLogInfo(bundleJob, logInfo);
+            LogUtils.setLogInfo(bundleJob);
             super.setJob(bundleJob);
             prevPending = bundleJob.isPending();
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
index 74fbcab..55b96b6 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
@@ -114,7 +114,7 @@ public class BundleStartXCommand extends StartTransitionXCommand {
     public void loadState() throws CommandException {
         try {
             this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, jobId);
-            LogUtils.setLogInfo(bundleJob, logInfo);
+            LogUtils.setLogInfo(bundleJob);
             super.setJob(bundleJob);
         }
         catch (XException ex) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
index ffb2d08..0f70e02 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
@@ -140,7 +140,7 @@ public class BundleSubmitXCommand extends SubmitTransitionXCommand {
             //verify the uniqueness of coord names
             verifyCoordNameUnique(resolvedJobXml);
             this.jobId = storeToDB(bundleBean, resolvedJobXml);
-            LogUtils.setLogInfo(bundleBean, logInfo);
+            LogUtils.setLogInfo(bundleBean);
 
             if (dryrun) {
                 Date startTime = bundleBean.getStartTime();

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java b/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
index 5d6ef65..fd50f69 100644
--- a/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
@@ -65,7 +65,7 @@ public class BundleUnpauseXCommand extends UnpauseTransitionXCommand {
      */
     @Override
     public void loadState() throws CommandException {
-        LogUtils.setLogInfo(bundleJob, logInfo);
+        LogUtils.setLogInfo(bundleJob);
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
index 9ac66b2..bb8a8b8 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
@@ -20,9 +20,7 @@ package org.apache.oozie.command.coord;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.CoordinatorJobBean;
@@ -72,6 +70,11 @@ public class CoordActionCheckXCommand extends CoordinatorXCommand<Void> {
         this.actionCheckDelay = actionCheckDelay;
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
     /* (non-Javadoc)
      * @see org.apache.oozie.command.XCommand#execute()
      */
@@ -174,7 +177,7 @@ public class CoordActionCheckXCommand extends CoordinatorXCommand<Void> {
                 coordJob = jpaService.execute(new CoordinatorJobGetForUserAppnameJPAExecutor(
                         coordAction.getJobId()));
                 workflowJob = jpaService.execute (new WorkflowJobGetForSLAJPAExecutor(coordAction.getExternalId()));
-                LogUtils.setLogInfo(coordAction, logInfo);
+                LogUtils.setLogInfo(coordAction);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
index 0a9e4fa..25eb222 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
@@ -90,6 +90,11 @@ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> {
         this.jobId = jobId;
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
     /**
      * Computes the nominal time of the next action.
      * Based on CoordMaterializeTransitionXCommand#materializeActions
@@ -648,7 +653,7 @@ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> {
         catch (JPAExecutorException je) {
             throw new CommandException(je);
         }
-        LogUtils.setLogInfo(coordAction, logInfo);
+        LogUtils.setLogInfo(coordAction);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java
index 562b211..f9a8af5 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java
@@ -53,6 +53,11 @@ public class CoordActionNotificationXCommand extends CoordinatorXCommand<Void> {
         this.actionBean = actionBean;
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionBean.getId());
+    }
+
     /* (non-Javadoc)
      * @see org.apache.oozie.command.XCommand#execute()
      */
@@ -133,7 +138,7 @@ public class CoordActionNotificationXCommand extends CoordinatorXCommand<Void> {
      */
     @Override
     protected void loadState() throws CommandException {
-        LogUtils.setLogInfo(actionBean, logInfo);
+        LogUtils.setLogInfo(actionBean);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
index ffe85f0..040fb68 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
@@ -50,6 +50,11 @@ public class CoordActionReadyXCommand extends CoordinatorXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(jobId);
+    }
+
+    @Override
     /**
      * Check for READY actions and change state to SUBMITTED by a command to submit the job to WF engine.
      * This method checks all the actions associated with a jobId to figure out which actions
@@ -157,7 +162,7 @@ public class CoordActionReadyXCommand extends CoordinatorXCommand<Void> {
         catch (JPAExecutorException e) {
             throw new CommandException(e);
         }
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionSkipXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionSkipXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionSkipXCommand.java
index c774f8e..5d31ec4 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionSkipXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionSkipXCommand.java
@@ -51,6 +51,11 @@ public class CoordActionSkipXCommand extends CoordinatorXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionBean.getId());
+    }
+
+    @Override
     protected Void execute() throws CommandException {
         if (actionBean.getStatus() == CoordinatorAction.Status.WAITING
                 || actionBean.getStatus() == CoordinatorAction.Status.READY) {
@@ -100,7 +105,7 @@ public class CoordActionSkipXCommand extends CoordinatorXCommand<Void> {
         catch (JPAExecutorException e) {
             throw new CommandException(e);
         }
-        LogUtils.setLogInfo(actionBean, logInfo);
+        LogUtils.setLogInfo(actionBean);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
index 1ca055d..25cbef1 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
@@ -56,9 +56,7 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 @SuppressWarnings("deprecation")
 public class CoordActionStartXCommand extends CoordinatorXCommand<Void> {
@@ -88,6 +86,11 @@ public class CoordActionStartXCommand extends CoordinatorXCommand<Void> {
         this.jobId = jobId;
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
     /**
      * Create config to pass to WF Engine 1. Get createdConf from coord_actions table 2. Get actionXml from
      * coord_actions table. Extract all 'property' tags and merge createdConf (overwrite duplicate keys). 3. Extract
@@ -292,7 +295,7 @@ public class CoordActionStartXCommand extends CoordinatorXCommand<Void> {
         catch (JPAExecutorException je) {
             throw new CommandException(je);
         }
-        LogUtils.setLogInfo(coordAction, logInfo);
+        LogUtils.setLogInfo(coordAction);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
index 5a5bf98..b31c903 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
@@ -50,6 +50,11 @@ public class CoordActionTimeOutXCommand extends CoordinatorXCommand<Void> {
         this.appName = ParamChecker.notEmpty(appName, "appName");
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionBean.getId());
+    }
+
     /* (non-Javadoc)
      * @see org.apache.oozie.command.XCommand#execute()
      */
@@ -110,7 +115,7 @@ public class CoordActionTimeOutXCommand extends CoordinatorXCommand<Void> {
         catch (JPAExecutorException e) {
             throw new CommandException(e);
         }
-        LogUtils.setLogInfo(actionBean, logInfo);
+        LogUtils.setLogInfo(actionBean);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
index 6e3af70..835a947 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
@@ -69,6 +69,11 @@ public class CoordActionUpdateXCommand extends CoordinatorXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(workflow.getId());
+    }
+
+    @Override
     protected Void execute() throws CommandException {
         try {
             LOG.debug("STARTED CoordActionUpdateXCommand for wfId=" + workflow.getId());
@@ -177,7 +182,7 @@ public class CoordActionUpdateXCommand extends CoordinatorXCommand<Void> {
                 if (coordAction != null) {
                     coordJob = jpaService
                             .execute(new CoordinatorJobGetForUserAppnameJPAExecutor(coordAction.getJobId()));
-                    LogUtils.setLogInfo(coordAction, logInfo);
+                    LogUtils.setLogInfo(coordAction);
                     break;
                 }
                 if (retries < maxRetries) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsIgnoreXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionsIgnoreXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsIgnoreXCommand.java
index ed85a40..6968e0d 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionsIgnoreXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsIgnoreXCommand.java
@@ -133,6 +133,6 @@ public class CoordActionsIgnoreXCommand extends IgnoreTransitionXCommand<Coordin
         }catch (Exception ex){
             throw new CommandException(ErrorCode.E0603, ex.getMessage(), ex);
         }
-        LogUtils.setLogInfo(this.coordJob, logInfo);
+        LogUtils.setLogInfo(this.coordJob);
     }
 }

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
index d2b4659..c3e6c90 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
@@ -85,7 +85,7 @@ public class CoordActionsKillXCommand extends KillTransitionXCommand<Coordinator
             jpaService = Services.get().get(JPAService.class);
             if (jpaService != null) {
                 coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB_ACTION_KILL, jobId);
-                LogUtils.setLogInfo(coordJob, logInfo);
+                LogUtils.setLogInfo(coordJob);
                 coordActions = CoordUtils.getCoordActions(rangeType, coordJob.getId(), scope, true);
             }
             else {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
index a2748c4..e55cc0a 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
@@ -99,6 +99,11 @@ public class CoordChangeXCommand extends CoordinatorXCommand<Void> {
         validateChangeValue(changeValue);
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(jobId);
+    }
+
     /**
      * @param changeValue change value.
      * @throws CommandException thrown if changeValue cannot be parsed properly.
@@ -490,7 +495,7 @@ public class CoordChangeXCommand extends CoordinatorXCommand<Void> {
             throw new CommandException(e);
         }
 
-        LogUtils.setLogInfo(this.coordJob, logInfo);
+        LogUtils.setLogInfo(this.coordJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java
index 91e9e09..b786a0d 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java
@@ -86,7 +86,7 @@ public class CoordKillXCommand extends KillTransitionXCommand {
                 //Get actions which are not succeeded, failed, timed out or killed
                 this.actionList = jpaService.execute(new CoordJobGetActionsNotCompletedJPAExecutor(jobId));
                 prevStatus = coordJob.getStatus();
-                LogUtils.setLogInfo(coordJob, logInfo);
+                LogUtils.setLogInfo(coordJob);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
index b4b2fef..e4156a8 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
@@ -195,7 +195,7 @@ public class CoordMaterializeTransitionXCommand extends MaterializeTransitionXCo
         // calculate start materialize and end materialize time
         calcMatdTime();
 
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java
index cc2127a..0404af9 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java
@@ -60,7 +60,7 @@ public class CoordPauseXCommand extends PauseTransitionXCommand {
     @Override
     public void loadState() throws CommandException {
         prevStatus = coordJob.getStatus();
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java
index ae71924..718e5a5 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java
@@ -97,6 +97,11 @@ public class CoordPushDependencyCheckXCommand extends CoordinatorXCommand<Void>
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
+    @Override
     protected Void execute() throws CommandException {
         String pushMissingDeps = coordAction.getPushMissingDependencies();
         if (pushMissingDeps == null || pushMissingDeps.length() == 0) {
@@ -352,7 +357,7 @@ public class CoordPushDependencyCheckXCommand extends CoordinatorXCommand<Void>
             coordAction = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(actionId));
             if (coordAction != null) {
                 coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
-                LogUtils.setLogInfo(coordAction, logInfo);
+                LogUtils.setLogInfo(coordAction);
             }
             else {
                 throw new CommandException(ErrorCode.E0605, actionId);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
index 735b295..f75be07 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
@@ -253,7 +253,7 @@ public class CoordRerunXCommand extends RerunTransitionXCommand<CoordinatorActio
         catch (JPAExecutorException je) {
             throw new CommandException(je);
         }
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
index 0aae1e6..50169a8 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
@@ -44,6 +44,7 @@ import org.apache.oozie.service.Services;
 import org.apache.oozie.util.InstrumentUtils;
 import org.apache.oozie.util.LogUtils;
 import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.util.XLog;
 
 /**
  * Resume coordinator job and actions.
@@ -90,7 +91,7 @@ public class CoordResumeXCommand extends ResumeTransitionXCommand {
         }
         setJob(coordJob);
         prevStatus = coordJob.getStatus();
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
index 02b30ef..9a200ec 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
@@ -239,8 +239,7 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand {
 
             jobId = storeToDB(appXml, eJob, coordJob);
             // log job info for coordinator job
-            LogUtils.setLogInfo(coordJob, logInfo);
-            LOG = XLog.resetPrefix(LOG);
+            LogUtils.setLogInfo(coordJob);
 
             if (!dryrun) {
                 queueMaterializeTransitionXCommand(jobId);
@@ -1267,8 +1266,7 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand {
             // this coord job is created from bundle
             coordJob.setBundleId(this.bundleId);
             // first use bundle id if submit thru bundle
-            logInfo.setParameter(DagXLogInfoService.JOB, this.bundleId);
-            LogUtils.setLogInfo(logInfo);
+            LogUtils.setLogInfo(this.bundleId);
         }
         if (this.coordName != null) {
             // this coord job is created from bundle

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
index b1b2fcd..b2b1579 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
@@ -93,7 +93,7 @@ public class CoordSuspendXCommand extends SuspendTransitionXCommand {
         catch (Exception ex) {
             throw new CommandException(ErrorCode.E0603, ex.getMessage(), ex);
         }
-        LogUtils.setLogInfo(this.coordJob, logInfo);
+        LogUtils.setLogInfo(this.coordJob);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java
index a177101..0f46238 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java
@@ -70,7 +70,7 @@ public class CoordUnpauseXCommand extends UnpauseTransitionXCommand {
     @Override
     public void loadState() throws CommandException {
         prevStatus = coordJob.getStatus();
-        LogUtils.setLogInfo(coordJob, logInfo);
+        LogUtils.setLogInfo(coordJob);
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/coord/CoordUpdateXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordUpdateXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordUpdateXCommand.java
index d6e47da..6b4ca0e 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordUpdateXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordUpdateXCommand.java
@@ -114,7 +114,7 @@ public class CoordUpdateXCommand extends CoordSubmitXCommand {
             throw new CommandException(e);
         }
 
-        LogUtils.setLogInfo(oldCoordJob, logInfo);
+        LogUtils.setLogInfo(oldCoordJob);
         if (!isConfChange) {
             try {
                 conf = new XConfiguration(new StringReader(coordJob.getConf()));

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java
index 39c522d..9c1ac13 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java
@@ -79,13 +79,18 @@ public class ActionCheckXCommand extends ActionXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
+    @Override
     protected void eagerLoadState() throws CommandException {
         try {
             this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_STATUS, jobId);
             this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION_ID_TYPE_LASTCHECK,
                     actionId);
-            LogUtils.setLogInfo(wfJob, logInfo);
-            LogUtils.setLogInfo(wfAction, logInfo);
+            LogUtils.setLogInfo(wfJob);
+            LogUtils.setLogInfo(wfAction);
         }
         catch (JPAExecutorException ex) {
             throw new CommandException(ex);
@@ -135,8 +140,8 @@ public class ActionCheckXCommand extends ActionXCommand<Void> {
         catch (JPAExecutorException e) {
             throw new CommandException(e);
         }
-        LogUtils.setLogInfo(wfJob, logInfo);
-        LogUtils.setLogInfo(wfAction, logInfo);
+        LogUtils.setLogInfo(wfJob);
+        LogUtils.setLogInfo(wfAction);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java
index 42cb290..6bcdc1f 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java
@@ -78,6 +78,11 @@ public class ActionEndXCommand extends ActionXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return true;
     }
@@ -101,8 +106,8 @@ public class ActionEndXCommand extends ActionXCommand<Void> {
                         jobId);
                 this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION_END,
                         actionId);
-                LogUtils.setLogInfo(wfJob, logInfo);
-                LogUtils.setLogInfo(wfAction, logInfo);
+                LogUtils.setLogInfo(wfJob);
+                LogUtils.setLogInfo(wfAction);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java
index 863bf7d..9c002f9 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java
@@ -75,6 +75,11 @@ public class ActionKillXCommand extends ActionXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return true;
     }
@@ -97,8 +102,8 @@ public class ActionKillXCommand extends ActionXCommand<Void> {
             if (jpaService != null) {
                 this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_ACTION_OP, jobId);
                 this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION, actionId);
-                LogUtils.setLogInfo(wfJob, logInfo);
-                LogUtils.setLogInfo(wfAction, logInfo);
+                LogUtils.setLogInfo(wfJob);
+                LogUtils.setLogInfo(wfAction);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java
index f3a4ba9..04f69f1 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java
@@ -91,6 +91,11 @@ public class ActionStartXCommand extends ActionXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return true;
     }
@@ -109,8 +114,8 @@ public class ActionStartXCommand extends ActionXCommand<Void> {
                     this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW, jobId);
                 }
                 this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION, actionId);
-                LogUtils.setLogInfo(wfJob, logInfo);
-                LogUtils.setLogInfo(wfAction, logInfo);
+                LogUtils.setLogInfo( wfJob);
+                LogUtils.setLogInfo(wfAction);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
index 0c4c548..741c3c6 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
@@ -46,6 +46,7 @@ import org.apache.oozie.service.Services;
 import org.apache.oozie.util.ELEvaluator;
 import org.apache.oozie.util.InstrumentUtils;
 import org.apache.oozie.util.Instrumentation;
+import org.apache.oozie.util.LogUtils;
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.workflow.WorkflowException;
 import org.apache.oozie.workflow.WorkflowInstance;

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/CompletedActionXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/CompletedActionXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/CompletedActionXCommand.java
index 41e6732..5f85bc2 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/CompletedActionXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/CompletedActionXCommand.java
@@ -49,6 +49,11 @@ public class CompletedActionXCommand extends WorkflowXCommand<Void> {
         this(actionId, externalStatus, actionData, 1);
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(actionId);
+    }
+
     /*
      * (non-Javadoc)
      *
@@ -63,7 +68,7 @@ public class CompletedActionXCommand extends WorkflowXCommand<Void> {
         catch (Exception ex) {
             throw new CommandException(ErrorCode.E0603, ex.getMessage(), ex);
         }
-        LogUtils.setLogInfo(this.wfactionBean, logInfo);
+        LogUtils.setLogInfo(this.wfactionBean);
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/DefinitionXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/DefinitionXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/DefinitionXCommand.java
index 64d4822..c34b82a 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/DefinitionXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/DefinitionXCommand.java
@@ -39,6 +39,11 @@ public class DefinitionXCommand extends WorkflowXCommand<String> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(jobId);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return false;
     }
@@ -55,7 +60,7 @@ public class DefinitionXCommand extends WorkflowXCommand<String> {
 
             if (jpaService != null) {
                 this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_DEFINITION, jobId);
-                LogUtils.setLogInfo(wfJob, logInfo);
+                LogUtils.setLogInfo(wfJob);
             }
             else {
                 LOG.error(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java
index 37a2f8b..2b3550e 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java
@@ -73,6 +73,11 @@ public class KillXCommand extends WorkflowXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(wfId);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return true;
     }
@@ -94,7 +99,7 @@ public class KillXCommand extends WorkflowXCommand<Void> {
             if (jpaService != null) {
                 this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_KILL, wfId);
                 this.actionList = jpaService.execute(new WorkflowActionsGetForJobJPAExecutor(wfId));
-                LogUtils.setLogInfo(wfJob, logInfo);
+                LogUtils.setLogInfo(wfJob);
             }
             else {
                 throw new CommandException(ErrorCode.E0610);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java
index 651b5fd..47a7f37 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java
@@ -41,6 +41,7 @@ public class NotificationXCommand extends WorkflowXCommand<Void> {
     private static final String NODE_NAME_PATTERN = "\\$nodeName";
 
     private String url;
+    private String id;
 
     //this variable is package private only for test purposes
     int retries = 0;
@@ -48,7 +49,7 @@ public class NotificationXCommand extends WorkflowXCommand<Void> {
     public NotificationXCommand(WorkflowJobBean workflow) {
         super("job.notification", "job.notification", 0);
         ParamChecker.notNull(workflow, "workflow");
-        LogUtils.setLogInfo(workflow, logInfo);
+        id = workflow.getId();
         url = workflow.getWorkflowInstance().getConf().get(OozieClient.WORKFLOW_NOTIFICATION_URL);
         if (url != null) {
             url = url.replaceAll(JOB_ID_PATTERN, workflow.getId());
@@ -60,8 +61,7 @@ public class NotificationXCommand extends WorkflowXCommand<Void> {
         super("action.notification", "job.notification", 0);
         ParamChecker.notNull(workflow, "workflow");
         ParamChecker.notNull(action, "action");
-        LogUtils.setLogInfo(workflow, logInfo);
-        LogUtils.setLogInfo(action, logInfo);
+        id = action.getId();
         url = workflow.getWorkflowInstance().getConf().get(OozieClient.ACTION_NOTIFICATION_URL);
         if (url != null) {
             url = url.replaceAll(JOB_ID_PATTERN, workflow.getId());
@@ -76,6 +76,11 @@ public class NotificationXCommand extends WorkflowXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(id);
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return false;
     }
@@ -95,8 +100,6 @@ public class NotificationXCommand extends WorkflowXCommand<Void> {
 
     @Override
     protected Void execute() throws CommandException {
-        //if command is requeue, the logInfo has to set to thread local Info object again
-        LogUtils.setLogInfo(logInfo);
         if (url != null) {
             int timeout = Services.get().getConf().getInt(NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY,
                                                           NOTIFICATION_URL_CONNECTION_TIMEOUT_DEFAULT);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
index 5dd06ca..040e7f5 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
@@ -112,13 +112,18 @@ public class ReRunXCommand extends WorkflowXCommand<Void> {
         this.conf = ParamChecker.notNull(conf, "conf");
     }
 
+    @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(jobId);
+    }
+
     /* (non-Javadoc)
      * @see org.apache.oozie.command.XCommand#execute()
      */
     @Override
     protected Void execute() throws CommandException {
         InstrumentUtils.incrJobCounter(getName(), 1, getInstrumentation());
-        LogUtils.setLogInfo(wfBean, logInfo);
+        LogUtils.setLogInfo(wfBean);
         WorkflowInstance oldWfInstance = this.wfBean.getWorkflowInstance();
         WorkflowInstance newWfInstance;
         String appPath = null;

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java
index 7b8ee3b..f226e44 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java
@@ -66,6 +66,11 @@ public class ResumeXCommand extends WorkflowXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(id);
+    }
+
+    @Override
     protected Void execute() throws CommandException {
         try {
             if (workflow.getStatus() == WorkflowJob.Status.SUSPENDED) {
@@ -187,7 +192,7 @@ public class ResumeXCommand extends WorkflowXCommand<Void> {
         catch (JPAExecutorException e) {
             throw new CommandException(e);
         }
-        LogUtils.setLogInfo(workflow, logInfo);
+        LogUtils.setLogInfo(workflow);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
index 4a7283f..c105fb1 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
@@ -58,7 +58,6 @@ import org.apache.oozie.util.InstrumentUtils;
 import org.apache.oozie.util.LogUtils;
 import org.apache.oozie.util.XConfiguration;
 import org.apache.oozie.util.ParamChecker;
-import org.apache.oozie.util.XLog;
 import org.apache.oozie.util.XmlUtils;
 import org.apache.oozie.util.db.SLADbXOperations;
 import org.jdom.Element;
@@ -96,6 +95,16 @@ public class SignalXCommand extends WorkflowXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        if (jobId != null) {
+            LogUtils.setLogInfo(jobId);
+        }
+        else if (actionId !=null) {
+            LogUtils.setLogInfo(actionId);
+        }
+    }
+
+    @Override
     protected boolean isLockRequired() {
         return true;
     }
@@ -116,10 +125,10 @@ public class SignalXCommand extends WorkflowXCommand<Void> {
             jpaService = Services.get().get(JPAService.class);
             if (jpaService != null) {
                 this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW, jobId);
-                LogUtils.setLogInfo(wfJob, logInfo);
+                LogUtils.setLogInfo(wfJob);
                 if (actionId != null) {
                     this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION_SIGNAL, actionId);
-                    LogUtils.setLogInfo(wfAction, logInfo);
+                    LogUtils.setLogInfo(wfAction);
                 }
             }
             else {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/SubmitHttpXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/SubmitHttpXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/SubmitHttpXCommand.java
index 5e9abcf..3d4092e 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/SubmitHttpXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/SubmitHttpXCommand.java
@@ -233,7 +233,7 @@ public abstract class SubmitHttpXCommand extends WorkflowXCommand<String> {
             workflow.setWorkflowInstance(wfInstance);
             workflow.setExternalId(conf.get(OozieClient.EXTERNAL_ID));
 
-            LogUtils.setLogInfo(workflow, logInfo);
+            LogUtils.setLogInfo(workflow);
             JPAService jpaService = Services.get().get(JPAService.class);
             if (jpaService != null) {
                 jpaService.execute(new WorkflowJobInsertJPAExecutor(workflow));

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
index 66baca1..63c50ea 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
@@ -211,8 +211,7 @@ public class SubmitXCommand extends WorkflowXCommand<String> {
                 workflow.setParentId(parentId);
             }
 
-            LogUtils.setLogInfo(workflow, logInfo);
-            LOG = XLog.resetPrefix(LOG);
+            LogUtils.setLogInfo(workflow);
             LOG.debug("Workflow record created, Status [{0}]", workflow.getStatus());
             Element wfElem = XmlUtils.parseXml(app.getDefinition());
             ELEvaluator evalSla = createELEvaluatorForGroup(conf, "wf-sla-submit");

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java
index 635186a..4f8bd21 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java
@@ -56,6 +56,11 @@ public class SuspendXCommand extends WorkflowXCommand<Void> {
     }
 
     @Override
+    protected void setLogInfo() {
+        LogUtils.setLogInfo(wfid);
+    }
+
+    @Override
     protected Void execute() throws CommandException {
         InstrumentUtils.incrJobCounter(getName(), 1, getInstrumentation());
         try {
@@ -151,7 +156,7 @@ public class SuspendXCommand extends WorkflowXCommand<Void> {
         catch (Exception ex) {
             throw new CommandException(ErrorCode.E0603, ex.getMessage(), ex);
         }
-        LogUtils.setLogInfo(this.wfJobBean, logInfo);
+        LogUtils.setLogInfo(this.wfJobBean);
     }
 
     @Override
@@ -185,6 +190,7 @@ public class SuspendXCommand extends WorkflowXCommand<Void> {
         catch (Exception ex) {
             throw new CommandException(ErrorCode.E0603, ex.getMessage(), ex);
         }
+        LogUtils.setLogInfo(wfJobBean);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
index 093eb08..546c564 100644
--- a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
+++ b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.client.OozieClient.SYSTEM_MODE;
+import org.apache.oozie.command.XCommand;
 import org.apache.oozie.util.Instrumentable;
 import org.apache.oozie.util.Instrumentation;
 import org.apache.oozie.util.PollablePriorityDelayQueue;
@@ -166,7 +167,6 @@ public class CallableQueueService implements Service, Instrumentable {
                 if (callableBegin(callable)) {
                     cron.stop();
                     addInQueueCron(cron);
-                    XLog.Info.get().clear();
                     XLog log = XLog.getLog(getClass());
                     log.trace("executing callable [{0}]", callable.getName());
 
@@ -179,9 +179,6 @@ public class CallableQueueService implements Service, Instrumentable {
                         incrCounter(INSTR_FAILED_COUNTER, 1);
                         log.warn("exception callable [{0}], {1}", callable.getName(), ex.getMessage(), ex);
                     }
-                    finally {
-                        XLog.Info.get().clear();
-                    }
                 }
                 else {
                     log.warn("max concurrency for callable [{0}] exceeded, requeueing with [{1}]ms delay", callable
@@ -495,7 +492,12 @@ public class CallableQueueService implements Service, Instrumentable {
         // minimum size equals to the maximum size (thus threads are keep always
         // running) and we are warming up
         // all those threads (the for loop that runs dummy runnables).
-        executor = new ThreadPoolExecutor(threads, threads, 10, TimeUnit.SECONDS, (BlockingQueue) queue);
+        executor = new ThreadPoolExecutor(threads, threads, 10, TimeUnit.SECONDS, (BlockingQueue) queue){
+            protected void beforeExecute(Thread t, Runnable r) {
+                super.beforeExecute(t,r);
+                XLog.Info.get().clear();
+            }
+        };
 
         for (int i = 0; i < threads; i++) {
             executor.execute(new Runnable() {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/service/EventHandlerService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/EventHandlerService.java b/core/src/main/java/org/apache/oozie/service/EventHandlerService.java
index 761537b..67acef8 100644
--- a/core/src/main/java/org/apache/oozie/service/EventHandlerService.java
+++ b/core/src/main/java/org/apache/oozie/service/EventHandlerService.java
@@ -72,7 +72,6 @@ public class EventHandlerService implements Service {
         try {
             Configuration conf = services.getConf();
             LOG = XLog.getLog(getClass());
-            LOG = XLog.resetPrefix(LOG);
             Class<? extends EventQueue> queueImpl = (Class<? extends EventQueue>) conf.getClass(CONF_EVENT_QUEUE, null);
             eventQueue = queueImpl == null ? new MemoryEventQueue() : (EventQueue) queueImpl.newInstance();
             eventQueue.init(conf);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/servlet/CallbackServlet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/servlet/CallbackServlet.java b/core/src/main/java/org/apache/oozie/servlet/CallbackServlet.java
index 541faca..36a73d4 100644
--- a/core/src/main/java/org/apache/oozie/servlet/CallbackServlet.java
+++ b/core/src/main/java/org/apache/oozie/servlet/CallbackServlet.java
@@ -74,16 +74,8 @@ public class CallbackServlet extends JsonRestServlet {
         if (actionId == null) {
             throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0402, queryString);
         }
-        int idx = actionId.lastIndexOf('@', actionId.length());
-        String jobId;
-        if (idx == -1) {
-            jobId = actionId;
-        }
-        else {
-            jobId = actionId.substring(0, idx);
-        }
-        setLogInfo(jobId, actionId);
         log = XLog.getLog(getClass());
+        setLogInfo(actionId);
         log.debug("Received a CallbackServlet.doGet() with query string " + queryString);
 
         DagEngine dagEngine = Services.get().get(DagEngineService.class).getSystemDagEngine();
@@ -113,16 +105,8 @@ public class CallbackServlet extends JsonRestServlet {
         if (actionId == null) {
             throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0402, queryString);
         }
-        int idx = actionId.lastIndexOf('@', actionId.length());
-        String jobId;
-        if (idx == -1) {
-            jobId = actionId;
-        }
-        else {
-            jobId = actionId.substring(0, idx);
-        }
-        setLogInfo(jobId, actionId);
         log = XLog.getLog(getClass());
+        setLogInfo(actionId);
         log.debug("Received a CallbackServlet.doPost() with query string " + queryString);
 
         validateContentType(request, RestConstants.TEXT_CONTENT_TYPE);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/servlet/HostnameFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/servlet/HostnameFilter.java b/core/src/main/java/org/apache/oozie/servlet/HostnameFilter.java
index afba9ec..8d5544e 100644
--- a/core/src/main/java/org/apache/oozie/servlet/HostnameFilter.java
+++ b/core/src/main/java/org/apache/oozie/servlet/HostnameFilter.java
@@ -81,6 +81,7 @@ public class HostnameFilter implements Filter {
                 hostname = "???";
             }
             HOSTNAME_TL.set(hostname);
+            XLog.Info.get().clear();
             chain.doFilter(request, response);
         }
         finally {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/servlet/JsonRestServlet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/servlet/JsonRestServlet.java b/core/src/main/java/org/apache/oozie/servlet/JsonRestServlet.java
index f7458dc..c754e45 100644
--- a/core/src/main/java/org/apache/oozie/servlet/JsonRestServlet.java
+++ b/core/src/main/java/org/apache/oozie/servlet/JsonRestServlet.java
@@ -26,6 +26,7 @@ import org.apache.oozie.service.ProxyUserService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.XLogService;
 import org.apache.oozie.util.Instrumentation;
+import org.apache.oozie.util.LogUtils;
 import org.apache.oozie.util.ParamChecker;
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.ErrorCode;
@@ -566,15 +567,11 @@ public abstract class JsonRestServlet extends HttpServlet {
     }
 
     /**
-     * Set the log info with the given information.
+     * Set the thread local log info with the given information.
      *
-     * @param jobid job ID.
      * @param actionid action ID.
      */
-    protected void setLogInfo(String jobid, String actionid) {
-        logInfo.setParameter(DagXLogInfoService.JOB, jobid);
-        logInfo.setParameter(DagXLogInfoService.ACTION, actionid);
-
-        XLog.Info.get().setParameters(logInfo);
+    protected void setLogInfo(String actionid) {
+        LogUtils.setLogInfo(actionid);
     }
 }

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/util/LogUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/LogUtils.java b/core/src/main/java/org/apache/oozie/util/LogUtils.java
index 814caff..65e0a7b 100644
--- a/core/src/main/java/org/apache/oozie/util/LogUtils.java
+++ b/core/src/main/java/org/apache/oozie/util/LogUtils.java
@@ -38,97 +38,92 @@ import org.apache.oozie.service.XLogService;
 public class LogUtils {
 
     /**
-     * Set the log info with the context of the given coordinator bean.
+     * Set the thread local log info with the context of the given coordinator bean.
      *
      * @param cBean coordinator bean.
-     * @param logInfo log info
      */
-    public static void setLogInfo(CoordinatorJobBean cBean, XLog.Info logInfo) {
-        if (logInfo.getParameter(XLogService.GROUP) == null) {
-            logInfo.setParameter(XLogService.GROUP, cBean.getGroup());
-        }
-        if (logInfo.getParameter(XLogService.USER) == null) {
-            logInfo.setParameter(XLogService.USER, cBean.getUser());
-        }
-        logInfo.setParameter(DagXLogInfoService.JOB, cBean.getId());
-        logInfo.setParameter(DagXLogInfoService.TOKEN, "");
-        logInfo.setParameter(DagXLogInfoService.APP, cBean.getAppName());
-        XLog.Info.get().setParameters(logInfo);
+    public static void setLogInfo(CoordinatorJobBean cBean) {
+        XLog.Info.get().setParameter(XLogService.GROUP, cBean.getGroup());
+        XLog.Info.get().setParameter(XLogService.USER, cBean.getUser());
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, cBean.getId());
+        XLog.Info.get().setParameter(DagXLogInfoService.TOKEN, "");
+        XLog.Info.get().setParameter(DagXLogInfoService.APP, cBean.getAppName());
+        XLog.Info.get().resetPrefix();
+
     }
 
     /**
-     * Set the log info with the context of the given coordinator action bean.
+     * Set the thread local log info with the context of the given coordinator action bean.
      *
      * @param action action bean.
-     * @param logInfo log info
      */
-    public static void setLogInfo(CoordinatorActionBean action, XLog.Info logInfo) {
-        logInfo.setParameter(DagXLogInfoService.JOB, action.getJobId());
-        logInfo.setParameter(DagXLogInfoService.ACTION, action.getId());
-        XLog.Info.get().setParameters(logInfo);
+    public static void setLogInfo(CoordinatorActionBean action) {
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, action.getJobId());
+        XLog.Info.get().setParameter(DagXLogInfoService.ACTION, action.getId());
+        XLog.Info.get().resetPrefix();
     }
 
     /**
-     * Set the log info with the context of the given workflow bean.
+     * Set the thread local log info with the context of the given workflow bean.
      *
      * @param workflow workflow bean.
-     * @param logInfo log info
      */
-    public static void setLogInfo(WorkflowJobBean workflow, XLog.Info logInfo) {
-        logInfo.setParameter(XLogService.GROUP, workflow.getGroup());
-        logInfo.setParameter(XLogService.USER, workflow.getUser());
-        logInfo.setParameter(DagXLogInfoService.JOB, workflow.getId());
-        logInfo.setParameter(DagXLogInfoService.TOKEN, workflow.getLogToken());
-        logInfo.setParameter(DagXLogInfoService.APP, workflow.getAppName());
-        XLog.Info.get().setParameters(logInfo);
+    public static void setLogInfo(WorkflowJobBean workflow) {
+        XLog.Info.get().setParameter(XLogService.GROUP, workflow.getGroup());
+        XLog.Info.get().setParameter(XLogService.USER, workflow.getUser());
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, workflow.getId());
+        XLog.Info.get().setParameter(DagXLogInfoService.TOKEN, workflow.getLogToken());
+        XLog.Info.get().setParameter(DagXLogInfoService.APP, workflow.getAppName());
+        XLog.Info.get().resetPrefix();
     }
 
     /**
-     * Set the log info with the context of the given action bean.
+     * Set the thread local log info with the context of the given action bean.
      *
      * @param action action bean.
-     * @param logInfo log info
      */
-    public static void setLogInfo(WorkflowActionBean action, XLog.Info logInfo) {
-        logInfo.setParameter(DagXLogInfoService.JOB, action.getJobId());
-        logInfo.setParameter(DagXLogInfoService.TOKEN, action.getLogToken());
-        logInfo.setParameter(DagXLogInfoService.ACTION, action.getId());
-        XLog.Info.get().setParameters(logInfo);
+    public static void setLogInfo(WorkflowActionBean action) {
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, action.getJobId());
+        XLog.Info.get().setParameter(DagXLogInfoService.TOKEN, action.getLogToken());
+        XLog.Info.get().setParameter(DagXLogInfoService.ACTION, action.getId());
+        XLog.Info.get().resetPrefix();
     }
 
-    public static void setLogInfo(WorkflowAction action, XLog.Info logInfo) {
+    public static void setLogInfo(WorkflowAction action) {
         String actionId = action.getId();
-        logInfo.setParameter(DagXLogInfoService.JOB, actionId.substring(0, actionId.indexOf("@")));
-        logInfo.setParameter(DagXLogInfoService.ACTION, actionId);
-        XLog.Info.get().setParameters(logInfo);
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, actionId.substring(0, actionId.indexOf("@")));
+        XLog.Info.get().setParameter(DagXLogInfoService.ACTION, actionId);
+        XLog.Info.get().resetPrefix();
     }
 
     /**
-     * Set the log info with the context of the given bundle bean.
-     *
-     * @param bBean bundle bean.
-     * @param logInfo log info
+     * Set the thread local log info with the given id.
+     * @param id jobId or actionId
      */
-    public static void setLogInfo(BundleJobBean bBean, XLog.Info logInfo) {
-        if (logInfo.getParameter(XLogService.GROUP) == null) {
-            logInfo.setParameter(XLogService.GROUP, bBean.getGroup());
-        }
-        if (logInfo.getParameter(XLogService.USER) == null) {
-            logInfo.setParameter(XLogService.USER, bBean.getUser());
+    public static void setLogInfo(String id) {
+        if (id.contains("@")) {
+            String jobId = id.substring(0, id.indexOf("@"));
+            XLog.Info.get().setParameter(DagXLogInfoService.JOB, jobId);
+            XLog.Info.get().setParameter(DagXLogInfoService.ACTION, id);
+        } else {
+            XLog.Info.get().setParameter(DagXLogInfoService.JOB, id);
+            XLog.Info.get().setParameter(DagXLogInfoService.ACTION, "");
         }
-        logInfo.setParameter(DagXLogInfoService.JOB, bBean.getId());
-        logInfo.setParameter(DagXLogInfoService.TOKEN, "");
-        logInfo.setParameter(DagXLogInfoService.APP, bBean.getAppName());
-        XLog.Info.get().setParameters(logInfo);
+        XLog.Info.get().resetPrefix();
     }
 
     /**
-     * Set the thread local log info with the context of the given Info object.
+     * Set the thread local log info with the context of the given bundle bean.
      *
-     * @param logInfo log info
+     * @param bBean bundle bean.
      */
-    public static void setLogInfo(XLog.Info logInfo) {
-        XLog.Info.get().setParameters(logInfo);
+    public static void setLogInfo(BundleJobBean bBean) {
+        XLog.Info.get().setParameter(XLogService.GROUP, bBean.getGroup());
+        XLog.Info.get().setParameter(XLogService.USER, bBean.getUser());
+        XLog.Info.get().setParameter(DagXLogInfoService.JOB, bBean.getId());
+        XLog.Info.get().setParameter(DagXLogInfoService.TOKEN, "");
+        XLog.Info.get().setParameter(DagXLogInfoService.APP, bBean.getAppName());
+        XLog.Info.get().resetPrefix();
     }
 
     public static XLog setLogInfo(XLog logObj, String jobId, String actionId, String appName) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/main/java/org/apache/oozie/util/XLog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/XLog.java b/core/src/main/java/org/apache/oozie/util/XLog.java
index 31a5ba0..762f8f5 100644
--- a/core/src/main/java/org/apache/oozie/util/XLog.java
+++ b/core/src/main/java/org/apache/oozie/util/XLog.java
@@ -43,6 +43,7 @@ public class XLog implements Log {
      */
     public static class Info {
         private static String template = "";
+        private String prefix = "";
         private static List<String> parameterNames = new ArrayList<String>();
 
         private static ThreadLocal<Info> tlLogInfo = new ThreadLocal<Info>() {
@@ -116,6 +117,7 @@ public class XLog implements Log {
          */
         public void clear() {
             parameters.clear();
+            resetPrefix();
         }
 
         /**
@@ -179,48 +181,35 @@ public class XLog implements Log {
             return MessageFormat.format(template, (Object[]) params);
         }
 
-    }
+        public String resetPrefix() {
+            return prefix = createPrefix();
+        }
+
+        public String getPrefix() {
+            return prefix;
+        }
 
-    /**
-     * Return the named logger configured with the {@link org.apache.oozie.util.XLog.Info} prefix.
-     *
-     * @param name logger name.
-     * @return the named logger configured with the {@link org.apache.oozie.util.XLog.Info} prefix.
-     */
-    public static XLog getLog(String name) {
-        return getLog(name, true);
-    }
 
-    /**
-     * Return the named logger configured with the {@link org.apache.oozie.util.XLog.Info} prefix.
-     *
-     * @param clazz from which the logger name will be derived.
-     * @return the named logger configured with the {@link org.apache.oozie.util.XLog.Info} prefix.
-     */
-    public static XLog getLog(Class clazz) {
-        return getLog(clazz, true);
     }
 
     /**
      * Return the named logger.
      *
      * @param name logger name.
-     * @param prefix indicates if the {@link org.apache.oozie.util.XLog.Info} prefix has to be used or not.
      * @return the named logger.
      */
-    public static XLog getLog(String name, boolean prefix) {
-        return new XLog(LogFactory.getLog(name), (prefix) ? Info.get().createPrefix() : "");
+    public static XLog getLog(String name) {
+        return new XLog(LogFactory.getLog(name));
     }
 
     /**
      * Return the named logger.
      *
      * @param clazz from which the logger name will be derived.
-     * @param prefix indicates if the {@link org.apache.oozie.util.XLog.Info} prefix has to be used or not.
      * @return the named logger.
      */
-    public static XLog getLog(Class clazz, boolean prefix) {
-        return new XLog(LogFactory.getLog(clazz), (prefix) ? Info.get().createPrefix() : "");
+    public static XLog getLog(Class clazz) {
+        return new XLog(LogFactory.getLog(clazz));
     }
 
     /**
@@ -251,7 +240,7 @@ public class XLog implements Log {
     //package private for testing purposes.
     Log[] loggers;
 
-    private String prefix = "";
+    private String prefix = null;
 
     /**
      * Create a <code>XLog</code> with no prefix.
@@ -259,17 +248,6 @@ public class XLog implements Log {
      * @param log Log instance to use for logging.
      */
     public XLog(Log log) {
-        this(log, "");
-    }
-
-    /**
-     * Create a <code>XLog</code> with a common prefix. <p/> The prefix will be prepended to all log messages.
-     *
-     * @param log Log instance to use for logging.
-     * @param prefix common prefix to use for all log messages.
-     */
-    public XLog(Log log, String prefix) {
-        this.prefix = prefix;
         loggers = new Log[2];
         loggers[0] = log;
         loggers[1] = LogFactory.getLog("oozieops");
@@ -290,7 +268,7 @@ public class XLog implements Log {
      * @param prefix the common prefix to set.
      */
     public void setMsgPrefix(String prefix) {
-        this.prefix = (prefix != null) ? prefix : "";
+        this.prefix = prefix;
     }
 
     //All the methods from the commonsLogging Log interface will log to the default logger only.
@@ -521,7 +499,7 @@ public class XLog implements Log {
     private void log(Level level, int loggerMask, String msgTemplate, Object... params) {
         loggerMask |= STD;
         if (isEnabled(level, loggerMask)) {
-            String prefix = getMsgPrefix();
+            String prefix = getMsgPrefix() != null ? getMsgPrefix() : Info.get().getPrefix();
             prefix = (prefix != null && prefix.length() > 0) ? prefix + " " : "";
 
             String msg = prefix + format(msgTemplate, params);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/core/src/test/java/org/apache/oozie/util/TestXLog.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/util/TestXLog.java b/core/src/test/java/org/apache/oozie/util/TestXLog.java
index 824e5dc..7b8a57c 100644
--- a/core/src/test/java/org/apache/oozie/util/TestXLog.java
+++ b/core/src/test/java/org/apache/oozie/util/TestXLog.java
@@ -100,6 +100,71 @@ public class TestXLog extends XTestCase {
         assertEquals("A[a]", XLog.Info.get().createPrefix());
     }
 
+    public class LogPrinter {
+        XLog LOG = XLog.getLog(LogPrinter.class);
+        public void setMsgPrefix(String prefix) {
+            LOG.setMsgPrefix(prefix);
+        }
+        public String getLogMsgPrefix() {
+            return LOG.getMsgPrefix();
+        }
+        public String getThreadLocalPrefix() {
+            return XLog.Info.get().getPrefix();
+        }
+        public String getLogPrefix() {
+            return LOG.getMsgPrefix() != null ? LOG.getMsgPrefix() : XLog.Info.get().getPrefix();
+        }
+    }
+
+    public void testInfoThreadLocalPrefix() throws Exception {
+        XLog.Info.defineParameter("JOB");
+        XLog.Info.defineParameter("ACTION");
+
+        assertEquals("JOB[-] ACTION[-]", XLog.Info.get().createPrefix());
+
+        String jobId = "XXX-W";
+        LogUtils.setLogInfo(jobId+"@start");
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@start]", XLog.Info.get().createPrefix());
+
+        final StringBuilder sb1 = new StringBuilder();
+        final StringBuilder sb2 = new StringBuilder();
+
+        final LogPrinter printer = new LogPrinter();
+
+        Thread t = new Thread() {
+            public void run() {
+                LogUtils.setLogInfo("XXX-W@hive");
+                sb1.append(printer.getLogMsgPrefix());
+                sb2.append(printer.getThreadLocalPrefix());
+            }
+        };
+        t.start();
+        t.join();
+
+        assertNull(printer.getLogMsgPrefix());
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@start]", printer.getThreadLocalPrefix());
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@start]", printer.getLogPrefix());
+
+        assertEquals("null", sb1.toString());
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@hive]", sb2.toString());
+    }
+
+    public void testLogMsg() throws Exception {
+        XLog.Info.defineParameter("JOB");
+        XLog.Info.defineParameter("ACTION");
+
+        final LogPrinter printer = new LogPrinter();
+        assertNull(printer.getLogMsgPrefix());
+
+        String jobId = "XXX-W";
+        LogUtils.setLogInfo(jobId+"@start");
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@start]", printer.getThreadLocalPrefix());
+        assertEquals("JOB[XXX-W] ACTION[XXX-W@start]", printer.getLogPrefix());
+
+        printer.setMsgPrefix("prefix");
+        assertEquals("prefix", printer.getLogPrefix());
+    }
+
     public void testFactory() {
         XLog log = XLog.getLog(getClass());
         assertNotNull(log);
@@ -110,6 +175,7 @@ public class TestXLog extends XTestCase {
         XLog.Info.defineParameter("A");
         XLog.Info.get().setParameter("A", "a");
         XLog log = XLog.getLog(getClass());
+        log.setMsgPrefix(XLog.Info.get().createPrefix());
         assertEquals("A[a]", log.getMsgPrefix());
     }
 
@@ -118,7 +184,7 @@ public class TestXLog extends XTestCase {
         TestLog ops = new TestLog();
         XLog xLog = new XLog(log);
 
-        assertEquals("", xLog.getMsgPrefix());
+        assertNull(xLog.getMsgPrefix());
         xLog.setMsgPrefix("prefix");
         assertEquals("prefix", xLog.getMsgPrefix());
         xLog.setMsgPrefix(null);

http://git-wip-us.apache.org/repos/asf/oozie/blob/fa2a205b/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index b84e96a..5023220 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,4 +1,5 @@
 -- Oozie 4.2.0 release (trunk - unreleased)
+OOZIE-1939 Incorrect job information is set while logging (seoeun25 via shwethags)
 OOZIE-1846 Convert CoordActionMaterializeCommand to an XCommand and remove Command (seoeun25 via shwethags)
 OOZIE-1943 Bump up trunk to 4.2.0-SNAPSHOT (bzhang)
 


Mime
View raw message