Details
Description
AsyncLogger caches a thread's name in a thread-local info variable. I make use of a thread pool where the submitted Runnables call Thread.setName() at the beginning of their task and the thread name is included in the log message. For an example of this behavior, see org.jboss.netty.util.ThreadRenamingRunnable in Netty 3.x. With the cached thread name, the log messages will contain whatever name the thread had when it logged for the first time and so long as the thread doesn't terminate (such as in a core pool thread), all log messages involving this thread will be erroneous. If Thread.getName has a significant performance impact for async logging, I would be satisfied if this behavior were configurable, perhaps on a per-logger basis, so that the penalty only needs to be taken by users who make use of Thread.setName()
Attachments
Attachments
Issue Links
- is related to
-
LOG4J2-2052 Disable thread name caching by default
- Closed