-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
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 if StructuredLogLayout
throws an Exception.
I added a test to check DefaultErrorHandler
prints errors but unfortunately, it did not work since Log42J StatusLogger
keeps the reference to the outdated PrintStreamCapture
.
Reproducer: main...nosan:spring-boot:log4j2-status-logger
If you run a single test shouldCaptureCustomizerError
in SampleLog4j2StructuredLoggingApplicationTests
everything will be fine, but if you run all tests in SampleLog4j2StructuredLoggingApplicationTests
, the CapturedOutput
will be empty and shouldCaptureCustomizerError
test will fail.
Possible fix main...nosan:spring-boot:log4j2-status-logger-fix but I am not sure this is the right way.