[ https://issues.apache.org/jira/browse/LOG4J2-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14938935#comment-14938935 ]
Gary Gregory commented on LOG4J2-1142: -------------------------------------- Why not just do a {{threadLocal.remove()}} when the appender is stop()'ed? We could make Layouts implement LifeCycle and have Layout.stop() methods where needed to do the {{threadLocal.remove()}}. The appender would then need to stop() its layout when it stop()s. Does that even make sense in a web container? Does our container plugin shutdown the context in this use case? > 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 > > > 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: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org