SOLR-18107: fix Log4j2Watcher, register parents#4113
SOLR-18107: fix Log4j2Watcher, register parents#4113dsmiley wants to merge 4 commits intoapache:mainfrom
Conversation
Now, explicitly traverse parent logger hierarchies when iterating through explicitly configured loggers. This ensures parent loggers are always included in Log4j2Watcher.getAllLoggers(). It seems Log4j 2.25.3 (or one > 2.21.0) changed behavior in ctx.getLoggers().
|
CC @ppkarwasz |
|
Disclaimer: I'm not 100% confident in the analysis... (done by Claude) but the code looks more robust now, in any event. |
|
Will merge tomorrow night if I hear nothing more. |
|
I'll look at it today. |
ppkarwasz
left a comment
There was a problem hiding this comment.
Hi @dsmiley,
Looks good to me!
I don't believe we have changed anything in 2.21.0 or later to break the getAllLoggers() logic: as you remarked, the Configuration.getLoggers() does and as far as I know always did return only the explicitly defined logger configurations.
Note: last year I started logging-admin to provide a simple API that allows users to retrieve and modify the logger configuration levels in a backend-independent way. I haven't had time to work on it since, but since similar code appears in Kafka, Solr and other applications, I could prioritize its first release.
Now, explicitly traverse parent logger hierarchies when iterating through explicitly configured loggers. This ensures parent loggers are always included in Log4j2Watcher.getAllLoggers(). It seems Log4j 2.25.3 (or one > 2.21.0) changed behavior in ctx.getLoggers().
https://issues.apache.org/jira/browse/SOLR-18107