When reconfiguring log4j and changing the level of the status logger to a higher level - e.g. from WARN to DEBUG, it doesn't work correctly.
Steps to reproduce:
- Configure from log4j2.xml containing:
<Configuration status="WARN" monitorInterval="5"> ...
- With the app running, change status to a higher level:
<Configuration status="DEBUG" monitorInterval="5"> ...
- Observe that the log config is reloaded, but no debug messages for the status logger appear.
From what I've seen this is because the StatusConfiguration.initialize() reconfigures the listeners' level
But it doesn't update the listenersLevel field that the StatusLogger uses for checking if the logger is enabled (I understand this should be the maximum of all of the listener's levels)
So in this case the listenersLevel is still at WARN, even though the console listener has a DEBUG level, and all the log messages are ignored because isEnabled(DEBUG) returns false.
- relates to
LOG4J2-947 A new StatusLoggerAdmin listener is added to StatusLogger every time the log is reconfigured