logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: [2/2] logging-log4j2 git commit: [LOG4J2-1299] Add pattern converter for thread id and priority in PatternLayout.
Date Tue, 01 Mar 2016 21:51:14 GMT
Gary, thanks for doing the work on this!

There's no need to cache the thread ID or priority in the ThreadNameCachingStrategy, we can
just ask the Thread.currentThread(). 

The reason the thread name is cached is that Thread.getName() is implemented as a JNI method
returning a char[] array, which is then wrapped in a new String. There's significant overhead
with that. Obtaining an int/long should not have that drawback. 

(Although I haven't checked the implementation on Thread, I hope they're not expensive JNI
methods, that would change things...)

Directly calling the relevant methods on Thread also means we don't need to autobox the values
which is nice. 

Sent from my iPhone

> On 2016/03/02, at 3:43, ggregory@apache.org wrote:
> ThreadNameCachingStrategy

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

View raw message