From 68c7fcf7d806040e5586313125f809c2db329ee3 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 16 Sep 2016 12:11:15 +0100 Subject: [PATCH] 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 #131 (but a /refresh is still broken) --- .../cloud/bootstrap/BootstrapApplicationListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java index c9cd071e..0af9497b 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java @@ -85,11 +85,18 @@ public class BootstrapApplicationListener ConfigurableApplicationContext context = bootstrapServiceContext(environment, event.getSpringApplication()); apply(context, event.getSpringApplication(), environment); + shutdownLogging(); + } + + private void shutdownLogging() { // Clean up the logging system. Logging will go dark until the // ConfigFileApplicationListener fires, but this is the price we pay for that // listener being able to adjust the log levels according to what it finds in its // own configuration. - LoggingSystem.get(ClassUtils.getDefaultClassLoader()).cleanUp(); + LoggingSystem loggingSystem = LoggingSystem + .get(ClassUtils.getDefaultClassLoader()); + loggingSystem.cleanUp(); + loggingSystem.beforeInitialize(); } private ConfigurableApplicationContext bootstrapServiceContext(