CapturedOutput is empty when using Log4J2 StatusLogger #43578
Labels
for: team-meeting
An issue we'd like to discuss as a team to make progress
status: waiting-for-triage
An issue we've not yet triaged
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: