Leonid Kazantsev created LOG4J2-1122:
----------------------------------------
Summary: Memory leak with dymanic configuration.
Key: LOG4J2-1122
URL: https://issues.apache.org/jira/browse/LOG4J2-1122
Project: Log4j 2
Issue Type: Bug
Components: Core
Affects Versions: 2.3, 2.2
Reporter: Leonid Kazantsev
There are put to
{code}private final ConcurrentMap<String, Logger> loggers = new
ConcurrentHashMap<String, Logger>();
at LoggerContext
{code}
But there is no remove, that's cause memory leak when using dynamic
configuration. Removing logger from configuration is not removing that logger
from context.
I'm using simple workaround for that issue:
{code}
loggersField = LoggerContext.class.getDeclaredField("loggers");
loggersField.setAccessible(true);
ConcurrentMap<String, org.apache.logging.log4j.core.Logger> loggers =
(ConcurrentMap<String, org.apache.logging.log4j.core.Logger>)
loggersField.get(ctx);
loggers.remove(loggerName);
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]