logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwilli...@apache.org
Subject svn commit: r1562688 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
Date Thu, 30 Jan 2014 04:08:03 GMT
Author: nickwilliams
Date: Thu Jan 30 04:08:03 2014
New Revision: 1562688

URL: http://svn.apache.org/r1562688
Log:
Fixing LOG4J2-323: ThreadLocal needs to be removed, not nulled out.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java?rev=1562688&r1=1562687&r2=1562688&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
Thu Jan 30 04:08:03 2014
@@ -81,6 +81,7 @@ public class AsyncLogger extends Logger 
     private static final int RINGBUFFER_DEFAULT_SIZE = 256 * 1024;
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
     private static final ThreadNameStrategy THREAD_NAME_STRATEGY = ThreadNameStrategy.create();
+    private static final ThreadLocal<Info> threadlocalInfo = new ThreadLocal<Info>();
 
     static enum ThreadNameStrategy { // LOG4J2-467
         CACHED {
@@ -109,7 +110,6 @@ public class AsyncLogger extends Logger 
 
     private static ExecutorService executor = Executors
             .newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger-"));
-    private static ThreadLocal<Info> threadlocalInfo = new ThreadLocal<Info>();
 
     static {
         initInfoForExecutorThread();
@@ -308,7 +308,7 @@ public class AsyncLogger extends Logger 
             }
         }
         executor.shutdown(); // finally, kill the processor thread
-        threadlocalInfo = new ThreadLocal<Info>(); // LOG4J2-323
+        threadlocalInfo.remove(); // LOG4J2-323
     }
 
     /**



Mime
View raw message