Skip to content
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

Open
nosan opened this issue Dec 19, 2024 · 0 comments
Open

CapturedOutput is empty when using Log4J2 StatusLogger #43578

nosan opened this issue Dec 19, 2024 · 0 comments
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

Comments

@nosan
Copy link
Contributor

nosan commented Dec 19, 2024

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.

@nosan nosan changed the title CapturedOutput is empty when using Log42J StatusLogger CapturedOutput is empty when using Log4J2 StatusLogger Dec 19, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 19, 2024
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants