diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java index 0ed4a54061..367d396c14 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java @@ -62,7 +62,7 @@ import org.springframework.web.context.WebApplicationContext; */ public abstract class SpringBootServletInitializer implements WebApplicationInitializer { - protected final Log logger = LogFactory.getLog(getClass()); + protected Log logger; // Don't initialize early private boolean registerErrorPageFilter = true; @@ -78,6 +78,9 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit @Override public void onStartup(ServletContext servletContext) throws ServletException { + // Logger initialization is deferred in case a ordered + // LogServletContextInitializer is being used + this.logger = LogFactory.getLog(getClass()); WebApplicationContext rootAppContext = createRootApplicationContext( servletContext); if (rootAppContext != null) {