[
https://issues.apache.org/jira/browse/LOG4J2-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14942516#comment-14942516
]
Remko Popma commented on LOG4J2-1142:
-------------------------------------
As a side note, the SEVERE warning goes away with this fix, but Tomcat still
complains about a memory leak if you press the "Detect memory leak" button.
However, this is not related to this issue: it also happened when I eliminated
the ThreadLocal completely and simply used a new StringBuilder instance for
each log event. This is something else in Log4j but I haven't had a chance to
investigate yet.
> 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]