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

java.lang.NullPointerException at java9 org.apache.logging.log4j.util.StackLocator.calcLocation()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.13.2
    • None
    • None

    Description

      When log() is called from a class using an instance created/stored at ThreadLocal
      its StackWalker.StackFrame names changes to "WrappingClass$ClassFromThreadLocal".

      This causes  NPE because walker.walk(LOCATOR) returns null.

      StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement();
      

      It is suggested to check the result of walk() for null-ness and react in the way different from NPE.

      Attachments

        Issue Links

          Activity

            People

              rgoers Ralph Goers
              yelistratov Andre Elis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m