You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2016/03/08 21:39:50 UTC

logging-log4j2 git commit: LOG4J2-248 - Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2ccf95d7c -> 04a9ce679


LOG4J2-248 - Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/04a9ce67
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/04a9ce67
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/04a9ce67

Branch: refs/heads/master
Commit: 04a9ce6792a4d867b766aa4e251495310c6debf5
Parents: 2ccf95d
Author: Matt Sicker <bo...@gmail.com>
Authored: Tue Mar 8 14:39:44 2016 -0600
Committer: Matt Sicker <bo...@gmail.com>
Committed: Tue Mar 8 14:39:44 2016 -0600

----------------------------------------------------------------------
 .../org/apache/logging/log4j/web/Log4jWebInitializerImpl.java   | 5 +++--
 src/changes/changes.xml                                         | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/04a9ce67/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java
----------------------------------------------------------------------
diff --git a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java
index 2da549c..3fcc7d9 100644
--- a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java
+++ b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java
@@ -41,6 +41,7 @@ import org.apache.logging.log4j.core.util.Loader;
 import org.apache.logging.log4j.core.util.NetUtils;
 import org.apache.logging.log4j.core.util.SetUtils;
 import org.apache.logging.log4j.spi.LoggerContextFactory;
+import org.apache.logging.log4j.util.LoaderUtil;
 
 /**
  * This class initializes and deinitializes Log4j no matter how the initialization occurs.
@@ -265,8 +266,8 @@ final class Log4jWebInitializerImpl extends AbstractLifeCycle implements Log4jWe
             // we compile against 3.0 to support Log4jServletContainerInitializer, but we don't require 3.0
             return this.servletContext.getClassLoader();
         } catch (final Throwable ignore) {
-            // otherwise, use this class's class loader
-            return Log4jWebInitializerImpl.class.getClassLoader();
+            // LOG4J2-248: use TCCL if possible
+            return LoaderUtil.getThreadContextClassLoader();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/04a9ce67/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1895b0f..68e3ec8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -211,6 +211,9 @@
       <action issue="LOG4J2-1206" dev="mattsicker" type="update">
         org.apache.logging.log4j.core.LoggerContext#updateLoggers should call firePropertyChangeEvent.
       </action>
+      <action issue="LOG4J2-248" dev="mattsicker" type="fix">
+        Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader.
+      </action>
     </release>
     <release version="2.5" date="2015-12-06" description="GA Release 2.5">
       <action issue="LOG4J2-324" dev="rpopma" type="fix">