ppkarwasz opened a new pull request, #3824:
URL: https://github.com/apache/logging-log4j2/pull/3824

   This change fixes a potential memory leak in the `log4j-to-slf4j` module 
(Logback Log4j API binding) caused by the use of a thread-local `LogBuilder` 
pool.
   
   The leak occurred because the thread-local field was **accidentally 
accessed**, even when `log4j2.enableThreadlocals` was set to `false`. In 
servlet environments, this could lead to classloader leaks due to the 
persistence of thread-local references.
   
   With this fix, all access to the `ThreadLocal` is now **properly** gated by 
the `log4j2.enableThreadlocals` system property—matching how similar pooling 
behavior is handled in Log4j Core.
   
   This preserves the GC-free option for advanced users who explicitly opt in 
via `log4j2.enableThreadlocals = true`, while avoiding memory leaks for others.
   
   Fixes #3819
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to