Skip to content

fix: Restore Backward Compatibility with Spring Boot Reconfiguration #3773

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

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

ppkarwasz
Copy link
Contributor

Although Spring Boot never directly starts a LoggerContext, its logging system — including our Log4j2SpringBootLoggingSystem and equivalents in Spring Boot 2.x and 3.x — has consistently used LoggerContext.start(Configuration) for reconfiguration.

To maintain backward compatibility with these usages, start(Configuration) now falls back to reconfigure(Configuration) if the context is already started.

Closes #3770

Add test verifying expected behavior of `LoggerContext.start(Configuration)` to ensure backward compatibility:

- The configuration must always be replaced, even if the context has already started.
- Only the first configuration should register the shutdown hook.
Although Spring Boot never directly starts a `LoggerContext`, its logging system — including our `Log4j2SpringBootLoggingSystem` and equivalents in Spring Boot 2.x and 3.x — has consistently used `LoggerContext.start(Configuration)` for reconfiguration.

To maintain backward compatibility with these usages, `start(Configuration)` now falls back to `reconfigure(Configuration)` if the context is already started.

Closes #3770
@ppkarwasz ppkarwasz moved this from To triage to In review in Log4j bug tracker Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

No Spring Boot logging output with Log4J 2.25.0
1 participant