From 8280004f800d2d3386bd8859a13dd6bc8d0c1c12 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 9 Jul 2015 16:48:49 -0700 Subject: [PATCH] Fix ClasspathLoggingApplicationListener order Commit 3de25164 inadvertently caused early debug logging from the ClasspathLoggingApplicationListener. We now set its order relative to the LoggingApplicationListener. See gh-2543 --- .../boot/logging/ClasspathLoggingApplicationListener.java | 3 +-- .../boot/logging/LoggingApplicationListener.java | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java index 2e8b272993d..051f93af239 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/ClasspathLoggingApplicationListener.java @@ -26,7 +26,6 @@ import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.context.ApplicationEvent; import org.springframework.context.event.GenericApplicationListener; import org.springframework.context.event.SmartApplicationListener; -import org.springframework.core.Ordered; import org.springframework.core.ResolvableType; /** @@ -40,7 +39,7 @@ import org.springframework.core.ResolvableType; public final class ClasspathLoggingApplicationListener implements GenericApplicationListener { - private static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 12; + private static final int ORDER = LoggingApplicationListener.DEFAULT_ORDER + 1; private final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index d89783a9474..7d3612fceee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -64,6 +64,11 @@ import org.springframework.util.StringUtils; */ public class LoggingApplicationListener implements GenericApplicationListener { + /** + * The default order for the LoggingApplicationListener. + */ + public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 20; + /** * The name of the Spring property that contains a reference to the logging * configuration to load. @@ -109,7 +114,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { private LoggingSystem loggingSystem; - private int order = Ordered.HIGHEST_PRECEDENCE + 20; + private int order = DEFAULT_ORDER; private boolean parseArgs = true;