Commits

Michael Heemskerk committed bd49052

CRUC-5254: added repository name in log messages created during indexing

Comments (0)

Files changed (3)

     <modelVersion>4.0.0</modelVersion>
     <groupId>com.atlassian.utils</groupId>
     <artifactId>atlassian-processutils</artifactId>
-    <version>1.3-SNAPSHOT</version>
+    <version>1.2.2-SNAPSHOT</version>
 
   <scm>
       <connection>scm:hg:${basedir}</connection>

processutils/src/main/java/com/atlassian/utils/process/LatchedRunnable.java

 package com.atlassian.utils.process;
 
 import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
 
+import java.util.Stack;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
     private CountDownLatch latch = new CountDownLatch(1);
     private Thread runner;
     private boolean cancelled;
+    private Stack<?> ndcStack = NDC.cloneStack();
 
     public final void run() {
         try {
+            NDC.inherit(ndcStack);
             runner = Thread.currentThread();
             doTask();
         } finally {
             latch.countDown();
+            NDC.remove();
         }
     }
 

processutils/src/main/java/com/atlassian/utils/process/LineOutputHandler.java

 package com.atlassian.utils.process;
 
-import org.apache.commons.io.IOUtils;
-
 import java.io.Closeable;
 import java.io.InputStream;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.io.UnsupportedEncodingException;
-import java.nio.Buffer;
 
 /**
  * An Output Handler which breaks the output from the process into