Commit e0f62308 authored by Phillip Webb's avatar Phillip Webb

Defer SpringBootServletInitializer getLog

Change `SpringBootServletInitializer` so that the logger is created
in `onStartup` rather than on class creation. The allows logging to
be initialized in an different WebApplicationInitializer.

Fixes gh-3704
parent f02c651e
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment