Skip to content

SOLR-18107: fix Log4j2Watcher, register parents#4113

Open
dsmiley wants to merge 4 commits intoapache:mainfrom
dsmiley:SOLR-18107-Fix-Log4j2Watcher
Open

SOLR-18107: fix Log4j2Watcher, register parents#4113
dsmiley wants to merge 4 commits intoapache:mainfrom
dsmiley:SOLR-18107-Fix-Log4j2Watcher

Conversation

@dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Feb 7, 2026

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

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().
@dsmiley
Copy link
Contributor Author

dsmiley commented Feb 7, 2026

CC @ppkarwasz

@dsmiley
Copy link
Contributor Author

dsmiley commented Feb 7, 2026

Disclaimer: I'm not 100% confident in the analysis... (done by Claude) but the code looks more robust now, in any event.

@dsmiley
Copy link
Contributor Author

dsmiley commented Feb 13, 2026

Will merge tomorrow night if I hear nothing more.

@ppkarwasz
Copy link
Contributor

I'll look at it today.

Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants