-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix typo in LoggerConfig.RootLogger.Builder#withtFilter (#3369) #3372
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Can you add a changelog entry (of type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use setFilter
instead of withFilter
.
I also noticed that none of our tests use the LoggerConfig
builder and they call the deprecated LoggerConfig#createLogger
method instead. Could you fix this?
log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Your two last commits are not signed and linked to the @jethomas-tsi account. Could you resign them, so I can merge the PR? git --force-rebase --gpg-sign origin/2.x
git push -f BTW: if you wait for the required checks to pass, feel free to merge this yourself. |
1f38f1b
to
78cc906
Compare
…der (apache#3369) Deprecated LoggerConfig.RootLogger.Builder#withtFilter(Filter). Added LoggerConfig.RoottLogger.Builder#withFilter(Filtter)
+ properly delegated from deprecated method to new method + updated affected package-info versions for baseline
* switched tests to use Builders instead of createLogger * changed new LoggerConig.RootLogger.Builder#withFilter to LoggerConfig.RootLogger.Builder#setFilter * deprecated LoggerConfig.Builder.withFilter and added LoggerConig.Builder.setFilter * moved changelog to correct .2.x.x directory
78cc906
to
d496f03
Compare
The `o.a.l.l.core.async` package was modified indirectly: `AsyncLoggerConfig` inherited the changes to `LoggerConfig`.
@ppkarwasz |
The overall goal is to transition all withers to setters in version 3.x, as described in #1206. Since the builders are mutable, the purpose is to use a naming pattern more common for mutable objects. |
From a user's perspective, this change seems poorly implemented and documented, which is extremely frustrating. |
Hi @norrisjeremy, Thanks for your questions—these are all excellent points, and I really appreciate you taking the time to raise them.
You're absolutely right to highlight the inconsistency. The focus of the PR was to correct a specific issue with Replacing all wither methods in the same Log4j Core plugin—or across all plugins—would indeed be more consistent. But that would have significantly expanded the scope of this PR. Since there are around 300 plugins, we felt it was better to handle that broader change separately. To address this, I’ve opened issue #3750 to track the work of adding setters and deprecating all remaining withers. If you're interested, contributions are always welcome!
It was actually mentioned in a resolved conversation here: #3372 (comment)
That’s a fair point. When preparing release notes, we tend to prioritize high-impact changes for the majority of users, most of whom use Log4j via configuration files. The Log4j Core internal API is mostly used by Log4j Plugin developers and integrators. As a result, API-level changes like this one can get less visibility, especially if they're part of a narrowly scoped fix. That said, you're absolutely right: this deprecation should have been classified as
I hear you, and I’m sorry the process came across that way. We always aim to provide a stable and predictable experience, and clearly we can improve how we communicate these kinds of changes. Out of curiosity—what kind of impact did this deprecation have on your application? Was it mainly the compiler warnings, or something else? Understanding that might help us improve how we handle and communicate such changes going forward. Thanks again for your feedback—it’s valuable and helps us improve the project for everyone. |
Hi @ppkarwasz, Thank you for your detailed response. To answer your question about the impact: we deliberately run compiler warnings & deprecations set to errors for our internal apps, so that they immediately cause a compilation failure, in order for our team to notice and deal with API deprecations immediately and avoid having them pile up over time. So we immediately noticed the deprecation when a Dependabot PR for one of our internal apps failed to build yesterday. And then when trying to load up the latest Javadocs, noticed that they had not yet been published on the website. This then led us to having to go dumpster diving through Github, to determine how to handle the deprecation, as well as why it had occurred. On top of this, this is the second time in past year that this API method has been touched. So all told, this is just frustrating: it results in lost time & productivity for what is amounting to whack-a-mole operation, chasing the whims of upstream library developers: deprecating and changing withers to setters in a Builder class just doesn't seem to offer tangible benefit to any existing users. Thanks, |
Hi @norrisjeremy,
That’s a great policy—seriously! 👏 It’s not something we see often; more typically, teams tend to tolerate deprecated methods and configuration properties until something breaks. Because of that, we don't usually factor the impact of deprecations into our decision-making. So, thank you for calling attention to your approach—it’s helpful context for us going forward.
That was ironically caused by a recent change in the Maven Javadoc Plugin (apache/maven-javadoc-plugin#1163). While it improved consistency, it also broke our site build 😉. This has now been fixed—thanks for bringing it to our attention!
Yes, good catch. That change was made in 21ad7be, back when we still allowed Commit-then-Review for “trivial” changes. That likely contributed to us forgetting about the "review" part of the process. We've since moved to a strict Review-then-Commit policy for all changes, which should help avoid similar oversights in the future.
Totally understandable. This change reflects an effort to standardize the API and address inconsistencies that date back to the early development of Log4j 2. That said, I agree that the change has only an aesthetic effect. I don't want to leave things in the middle, so I’ve scheduled #3750 for the As mentioned, we assume most users rely on configuration files—which are unaffected by these changes. But for those constructing configurations programmatically, we recommend using |
In LoggerConfig.RootLogger.Builder: