forked from spring-projects/spring-amqp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spring-projectsGH-1148: Log4jAppender - fix initialization cycle
Resolves spring-projects#1148 Defer creation of all Spring static loggers from appender until the appender is initialized. The first logger (e.g. Spring Boot) initializes the static `LoggerContext` field in `LogAdapter.Log4jLog`; this, in turn initializes the appender. However, the appender references Spring objects that have static loggers. This causes the `Log4jLog` CTOR to be called before the field is initialized, causing an NPE. Defer creation of all static loggers until the appender is fully initialized. Tested with the log4j2 sample app. Also add a test for async sends. **cherry-pick to 2.1.x**
- Loading branch information
1 parent
abc96cf
commit d9cac27
Showing
3 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters