Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-893

NullPointerException on core.Logger$PrivateConfig.filter() when mapping JUL to Log4j2

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Mac OSX, Scala 2.10.4, SBT 0.13, Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

      Description

      I have a project in scala loading log4j2-core, api, jul, slf4j and jcl and try to map the JUL to Log4J by using the following java parameter:

      -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager

      I also use Twitter Server which uses JUL to log it's messages.

      When I start up the server with the JUL mapping for Log4J I get a NullPointerException.

      The exception and code is here:
      https://gist.github.com/mmlac/2e2b38dc3fbd0e5b0da4

      Might be related to LOG4J2-234

      ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
      Exception in thread "main" java.lang.ExceptionInInitializerError
      at com.twitter.server.Admin$class.$init$(Admin.scala:13)
      at foo.bar.Foo$.<init>(Foo.scala:8)
      at foo.bar.Foo$.<clinit>(Foo.scala)
      at foo.bar.Foo.main(Foo.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      Caused by: java.lang.NullPointerException
      at org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Logger.java:301)
      at org.apache.logging.log4j.core.Logger.isEnabled(Logger.java:122)
      at org.apache.logging.log4j.spi.ExtendedLoggerWrapper.isEnabled(ExtendedLoggerWrapper.java:87)
      at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:699)
      at org.apache.logging.log4j.jul.WrappedLogger.log(WrappedLogger.java:50)
      at org.apache.logging.log4j.jul.ApiLogger.log(ApiLogger.java:106)
      at com.twitter.finagle.util.LoadService$$anonfun$apply$9.apply(LoadService.scala:186)
      at com.twitter.finagle.util.LoadService$$anonfun$apply$9.apply(LoadService.scala:181)
      at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
      at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
      at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
      at scala.collection.AbstractTraversable.map(Traversable.scala:105)
      at com.twitter.finagle.util.LoadService$.apply(LoadService.scala:181)
      at com.twitter.finagle.http.HttpMuxer$.<init>(HttpMuxer.scala:118)
      at com.twitter.finagle.http.HttpMuxer$.<clinit>(HttpMuxer.scala)
      ... 9 more
      

        Attachments

        1. breaklog4jul.zip
          185 kB
          Markus Lachinger

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mmlac Markus Lachinger
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: