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

NPE in ThrowableProxy when resolving stack in Java EE/OSGi environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7
    • 2.8
    • Core
      • java version "1.7.0_80" ,Java(TM) SE Runtime Environment (build 1.7.0_80-b15), Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
      • Jboss EAP 5.2.0-EAP

    Description

      NPE when logging in Java EE/OSGi environment.

      In some cases the ClassLoader ( https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getClassLoader() ) will be null for a Class.

      With the changes introduced in
      https://issues.apache.org/jira/browse/LOG4J2-1457 logging with %xEx can cause a NullPointerExeception when trying to resolve the stack.

      Since it's not a common occurrence in most environments I suggest the ThrowableProxy swallow the NPE in the same way it swallows SecurityExeception and other classloading exceptions to avoid extra branching for all environments.

      Attachments

        1. error.log
          4 kB
          Robert Christiansen
        2. LOG4J2-1687.patch
          4 kB
          Robert Christiansen
        3. patch.diff
          1 kB
          Robert Christiansen

        Activity

          People

            ggregory Gary D. Gregory
            hjertmann Robert Christiansen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: