logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51612] New: LoggingEvent can contain wrong thread name in multithreaded environment
Date Thu, 04 Aug 2011 09:03:15 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51612

             Bug #: 51612
           Summary: LoggingEvent can contain wrong thread name in
                    multithreaded environment
           Product: Log4j
           Version: 1.2
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: r_gorbonosov@mail.ru
    Classification: Unclassified


Created attachment 27347
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27347
Simple code demonstrating the bug

Log4j version: 1.2.16

I have an appender attached to a logger. This appender performs the
LoggingEvent processing in a thread other than the thread where the
LoggingEvents were generated. Due to that fact that LoggingEvent.threadName is
lazily initialized (under certain conditions: there are different constructors
and I don't know which one is used when) I'm getting a wrong thread name in the
LoggingEvent.

Probably the LoggingEvent.threadName should not be lazily initialized.

In attachment there is a simple code demonstrating the bug.

In addition please pay attention that LoggingEvent class is not thread-safe:
access to LoggingEvent.threadName is not synchronized. So if in the example
above I have several appenders processing LoggingEvents in different threads
the actual thread name visible to appenders is unpredictable.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message