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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rgoers Ralph Goers
            yelistratov Andre Elis
            Votes:
            0 Vote for this issue
            Watchers:
            4 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

                Slack

                  Issue deployment