-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
CapturedOutput is empty when using Log4J2 StatusLogger #43578
Comments
Thanks @nosan, I've taken your test and a slightly different fix. I hope that's OK. Let me know if you see any potential issues. |
Thanks, @philwebb. Maybe reset fallbackListener's stream should be applied only in the smoke-test. |
I did a bit of manual testing for that and I think |
@nosan @philwebb I would like to point to an issue in BlockHound (reactor/BlockHound#469), caused by this issue and the corresponding changes. IMO there is an issue with |
Thanks for tracking down the root cause, @violetagg. I've re-opened #43963. |
While working on #43575 I noticed that Log4j2 Smoke Tests does not contain a test to verify that
DefaultErrorHandler
prints an error into the console ifStructuredLogLayout
throws an Exception.I added a test to check
DefaultErrorHandler
prints errors but unfortunately, it did not work since Log42JStatusLogger
keeps the reference to the outdatedPrintStreamCapture
.Reproducer: main...nosan:spring-boot:log4j2-status-logger
If you run a single test
shouldCaptureCustomizerError
inSampleLog4j2StructuredLoggingApplicationTests
everything will be fine, but if you run all tests inSampleLog4j2StructuredLoggingApplicationTests
, theCapturedOutput
will be empty andshouldCaptureCustomizerError
test will fail.Possible fix main...nosan:spring-boot:log4j2-status-logger-fix but I am not sure this is the right way.
The text was updated successfully, but these errors were encountered: