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

Backport part of #2062 to 2.x branch. #2454

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

Conversation

ppkarwasz
Copy link
Contributor

@ppkarwasz ppkarwasz commented Apr 9, 2024

This backports the part of PR #2062 that concerns spring-projects/spring-boot#33450 to the 2.x branch.

It contains two sets of changes:

  • it catches exceptions thrown by property sources and logs them as warnings,
  • it adds a PropertiesUtil#removePropertySource to allow Spring Boot to remove its custom property source, when the Spring Environment becomes unavailable at shutdown.

Note that the second change will not be effective until Spring Boot starts using it, which can happen only after a 2.24.0 release of Log4j API.

Remark: the part of PR #2062 that concerns #1799 was not backported, since I believe it to be a Spring Boot problem:

  1. Spring Boot should not perform an unchecked cast of o.a.l.l.spi.LoggerContext,
  2. Spring Boot should not call LogManager.getContext multiple times, but cache the LoggerContext it received at startup.

Fixes #2453

The property source comparator should not merge distinct property
sources with the same priority.
@ppkarwasz
Copy link
Contributor Author

I also included a fix for LOG4J2-3618 in this PR, which caused the original test case to fail.

If your prefer to split this fix into a separate PR, I can do it.

@ppkarwasz ppkarwasz requested a review from vy June 28, 2024 12:57
@ppkarwasz ppkarwasz requested a review from vy July 2, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spring boot 3.2.4 + spring-boot-starter-log4j2 + spring-boot-starter-undertow
3 participants