-
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
[FOLLOWUP] Fix StatusLogger log level filtering when debug mode is enabled #2340
Conversation
cc @vy @ppkarwasz |
@@ -134,7 +165,7 @@ public Level getStatusLevel() { | |||
@Override | |||
public void log(final StatusData data) { | |||
requireNonNull(data, "data"); | |||
if (level.isLessSpecificThan(data.getLevel())) { | |||
if (debugEnabled || level.isLessSpecificThan(data.getLevel())) { |
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.
I think the correct fix is to remove the filtering on level here. StatusLogger
is already taking care of the filtering, listeners should not (incorrectly!) duplicate that work. Hence, instead of leaking debugEnabled
to StatusConsoleListener
, could you remove this if
block, please?
As a result of this change, StatusConsoleListenerTest#level_and_stream_should_be_honored
test will be broken. Could you rename it to stream_should_be_honored
and fix it too, please? There you won't need multiple messages with different levels anymore. Checking the dump of a single message should be good enough.
I can share some development tips to quickly iterate over your changes:
- Compile your
log4j-api
changes:./mvnw clean install -Dmaven.test.skip -Dspotless.skip -Dcyclonedx.skip -Dspotbugs.skip -Drat.skip -Dbnd.baseline.skip -pl :log4j-api
- Make sure you fixed
StatusConsoleListenerTest
:./mvnw test -Dspotless.skip -Dcyclonedx.skip -Dspotbugs.skip -Drat.skip -Dbnd.baseline.skip -pl :log4j-api-test -Dtest=StatusConsoleListenerTest
- Fix formatting:
./mvnw spotless:apply -pl :log4j-api,:log4j-api-test
- Make sure all is in good shape:
./mvnw clean install -pl :log4j-api,:log4j-api-test
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.
Sure, let me try making it.
…de is enabled" This reverts commit 0407c14.
The local verification results are as follows:
It's okay. |
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
Great job! 💯 |
Thank you very much for the help provided by @vy and @ppkarwasz |
Yes, it was last week, until you told us |
Haha.., thank you very much! ❤️ |
Follow up for #2338,
Fixes #2337 and makes StatusLogger take debug mode into account.