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

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13.2
    • Component/s: None
    • Labels:
      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

              • Assignee:
                rgoers Ralph Goers
                Reporter:
                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