-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The core.Logger#setLevel
method should work like Configurator#setLevel
#2281
Labels
Milestone
Comments
ppkarwasz
added
the
bug
Incorrect, unexpected, or unintended behavior of existing code
label
Feb 12, 2024
I was bitten by this issue in Apache Commons Logging. |
Thanks for investigation, @ppkarwasz. I would like to add a 3rd option to the list above:
|
garydgregory
added a commit
to garydgregory/logging-log4j2
that referenced
this issue
Feb 13, 2024
Configurator#setLevel apache#2281
garydgregory
added a commit
to garydgregory/logging-log4j2
that referenced
this issue
Feb 13, 2024
Configurator#setLevel apache#2281
garydgregory
added a commit
that referenced
this issue
Feb 14, 2024
* The core.Logger#setLevel method should work like Configurator#setLevel #2281 * Fix `Logger#setLevel` to work as in Log4j 1.2 --------- Co-authored-by: Piotr P. Karwasz <[email protected]>
TY @ppkarwasz for helping out with #2282, merged! 👍 |
Let's leave this issue open, until we check |
garydgregory
added a commit
to garydgregory/logging-log4j2
that referenced
this issue
Feb 15, 2024
Configurator#setLevel apache#2281 Do for this module what we did for log4j-1.2-api
garydgregory
added a commit
to garydgregory/logging-log4j2
that referenced
this issue
Feb 15, 2024
Configurator#setLevel apache#2281 Do for this module what we did for log4j-1.2-api
garydgregory
added a commit
to garydgregory/logging-log4j2
that referenced
this issue
Feb 15, 2024
Configurator#setLevel apache#2281 Do for this module what we did for log4j-1.2-api
garydgregory
added a commit
that referenced
this issue
Feb 15, 2024
…ator#setLevel() (#2289) * [Issue2281] The core.Logger#setLevel method should work like Configurator#setLevel #2281 Do for this module what we did for log4j-1.2-api * Update log4j-jul/src/test/java/org/apache/logging/log4j/jul/test/CoreLoggerTest.java Co-authored-by: Piotr P. Karwasz <[email protected]> --------- Co-authored-by: Piotr P. Karwasz <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The main difference between the
core.Logger#setLevel
method andConfigurator#setLevel
is that the former changes only the level of a specific logger, while the latter also changes the level of child loggers.As documented in its Javadoc, the
core.Logger#setLevel
method is not part of the public API (so it can do whatever it wants). However it is used inlog4j-1.2-api
andlog4j-jul
instead of the more correctConfigurator#setLevel
method and it causes those modules to misbehave.We can therefore:
Logger#setLevel
works to match the behavior ofConfigurator#setLevel
(IMHO it is the best option, since it prevents mistakes from committers and users),Logger#setLevel
withConfigurator#setLevel
inlog4j-1.2-api
andlog4j-jul
.The text was updated successfully, but these errors were encountered: