logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Lamy (*$^¨%`£) (JIRA) <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector
Date Mon, 05 Nov 2012 11:14:12 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490572#comment-13490572
] 

Olivier Lamy (*$^¨%`£) commented on LOG4J2-108:
-----------------------------------------------

I tried to use log4j2 with maven trunk.
Path to apply:
{code}

diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index ce547e7..263223f 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -83,9 +83,19 @@
       <groupId>org.sonatype.aether</groupId>
       <artifactId>aether-connector-wagon</artifactId>
     </dependency>
-    <dependency>
+    <!--dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
+    </dependency-->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-ext</artifactId>
+      <version>1.7.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j.adapters</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <version>2.0-beta3-SNAPSHOT</version>
     </dependency>
   </dependencies>
 
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 3990785..ba69f85 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -324,7 +324,7 @@ public class MavenCli
 
         plexusLoggerManager = new Slf4jLoggerManager();       
         slf4jLoggerFactory = LoggerFactory.getILoggerFactory();
-        slf4jLogger = slf4jLoggerFactory.getLogger(this.getClass().getName());
+        slf4jLogger = LoggerFactory.getLogger(this.getClass().getName());
     }
 
     private void version( CliRequest cliRequest )
{code}
Then put a log4j2.xml in apache-maven/src/conf/logging/log4j2.xml
svn path: http://svn.apache.org/repos/asf/maven/maven-3/trunk/

                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> java.lang.NullPointerException
> 	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:102)
> 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:73)
> 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
> 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:247)
> 	at org.slf4j.helpers.Log4JLoggerFactory$PrivateManager.getContext(Log4JLoggerFactory.java:103)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getContext(Log4JLoggerFactory.java:89)
> 	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:45)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message