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

LogEventWrapper.getThread only works on the first invocation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.13.3
    • Fix Version/s: 2.14.0
    • Component/s: log4j 1.2 emulation
    • Labels:
      None

      Description

      LogEventWrapper.getThread attempts to memoize the thread value but returns null if the thread field is already set where it should return the field value.

       

      Additionally the thread is discovered using Thread.getAllStackTraces which is an expensive operation. In most cases it should be sufficient to check only the current thread, if the getThread method is called from another thread there's no guarantee that the original thread still uses the same name, or that it still exists.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ckozak Carter Kozak
                Reporter:
                ckozak Carter Kozak
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 1h
                  1h