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: [email protected]
ReportedBy: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]