[ 
https://issues.apache.org/jira/browse/LOG4J2-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14942467#comment-14942467
 ] 

Remko Popma edited comment on LOG4J2-1142 at 10/3/15 9:50 PM:
--------------------------------------------------------------

You are looking at the wrong column. The Score column shows the nanoseconds/op 
result. (Actually the average of 20 iterations.) The 20 ns/op is the Error 
column, indicating the variance between the 20 iterations.

If you look at the benchmark code you will see that it does more than just 
obtain a StringBuilder: it also formats a complete log event to the {{"%d %5p 
\[%t\] %c\{1\} %X\{transactionId\} - %m%n"}} layout pattern. So this is 
representative for the work that PatternLayout does.


was (Author: [email protected]):
You are looking at the wrong column. The Score column shows the nanoseconds/op 
result. (Actually the average of 20 iterations.) The 20 ns/op is the Error 
column, indicating the variance between the 20 iterations.

> ThreadLocals in Layout implementations should be non-static to prevent memory 
> leaks in web containers
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1142
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1142
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.4
>            Reporter: Dmitri Blinov
>            Assignee: Remko Popma
>             Fix For: 2.4.1
>
>         Attachments: LOG4J2-1142.patch
>
>
> As discussed in LOG4J2-1125, storing ThreadLocal<StringBuilder> in a static 
> field may not interact well with the thread pools and class loaders of some 
> web containers and may result in memory leaks, especially in older web 
> containers.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to