Skip to content

Commit 68c7fcf

Browse files
author
Dave Syer
committed
Apply correct ordering in logging system on startup
Completes the work started in 7f687b1, where the call to LoggingSystem.beforeInitialization() was ommitted which results in JUL logging never being available in the application. Partial fix for spring-projects#131 (but a /refresh is still broken)
1 parent 30a7bb9 commit 68c7fcf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,18 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
8585
ConfigurableApplicationContext context = bootstrapServiceContext(environment,
8686
event.getSpringApplication());
8787
apply(context, event.getSpringApplication(), environment);
88+
shutdownLogging();
89+
}
90+
91+
private void shutdownLogging() {
8892
// Clean up the logging system. Logging will go dark until the
8993
// ConfigFileApplicationListener fires, but this is the price we pay for that
9094
// listener being able to adjust the log levels according to what it finds in its
9195
// own configuration.
92-
LoggingSystem.get(ClassUtils.getDefaultClassLoader()).cleanUp();
96+
LoggingSystem loggingSystem = LoggingSystem
97+
.get(ClassUtils.getDefaultClassLoader());
98+
loggingSystem.cleanUp();
99+
loggingSystem.beforeInitialize();
93100
}
94101

95102
private ConfigurableApplicationContext bootstrapServiceContext(

0 commit comments

Comments
 (0)