Commit 8bf3f275 authored by Phillip Webb's avatar Phillip Webb

Merge branch '1.3.x'

parents e03e1098 49676ee9
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<hikaricp.version>2.4.7</hikaricp.version> <hikaricp.version>2.4.7</hikaricp.version>
<hikaricp-java6.version>2.3.13</hikaricp-java6.version> <hikaricp-java6.version>2.3.13</hikaricp-java6.version>
<hornetq.version>2.4.7.Final</hornetq.version> <hornetq.version>2.4.7.Final</hornetq.version>
<hsqldb.version>2.3.4</hsqldb.version> <hsqldb.version>2.3.3</hsqldb.version>
<htmlunit.version>2.21</htmlunit.version> <htmlunit.version>2.21</htmlunit.version>
<httpasyncclient.version>4.1.2</httpasyncclient.version> <httpasyncclient.version>4.1.2</httpasyncclient.version>
<httpclient.version>4.5.2</httpclient.version> <httpclient.version>4.5.2</httpclient.version>
......
...@@ -693,7 +693,8 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -693,7 +693,8 @@ public class TomcatEmbeddedServletContainerFactory
/** /**
* {@link LifecycleListener} that stores an empty merged web.xml. This is critical for * {@link LifecycleListener} that stores an empty merged web.xml. This is critical for
* Jasper to prevent warnings about missing web.xml files and to enable EL. * Jasper on Tomcat 7 to prevent warnings about missing web.xml files and to enable
* EL.
*/ */
private static class StoreMergedWebXmlListener implements LifecycleListener { private static class StoreMergedWebXmlListener implements LifecycleListener {
...@@ -708,10 +709,8 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -708,10 +709,8 @@ public class TomcatEmbeddedServletContainerFactory
private void onStart(Context context) { private void onStart(Context context) {
ServletContext servletContext = context.getServletContext(); ServletContext servletContext = context.getServletContext();
if (servletContext if (servletContext.getAttribute(MERGED_WEB_XML) == null) {
.getAttribute(StoreMergedWebXmlListener.MERGED_WEB_XML) == null) { servletContext.setAttribute(MERGED_WEB_XML, getEmptyWebXml());
servletContext.setAttribute(StoreMergedWebXmlListener.MERGED_WEB_XML,
getEmptyWebXml());
} }
TomcatResources.get(context).addClasspathResources(); TomcatResources.get(context).addClasspathResources();
} }
......
...@@ -130,13 +130,13 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { ...@@ -130,13 +130,13 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
@Override @Override
public void beforeInitialize() { public void beforeInitialize() {
super.beforeInitialize(); super.beforeInitialize();
getRootLoggerConfig().addFilter(FILTER); getLoggerContext().getConfiguration().addFilter(FILTER);
} }
@Override @Override
public void initialize(LoggingInitializationContext initializationContext, public void initialize(LoggingInitializationContext initializationContext,
String configLocation, LogFile logFile) { String configLocation, LogFile logFile) {
getRootLoggerConfig().removeFilter(FILTER); getLoggerContext().getConfiguration().removeFilter(FILTER);
super.initialize(initializationContext, configLocation, logFile); super.initialize(initializationContext, configLocation, logFile);
} }
...@@ -204,10 +204,6 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { ...@@ -204,10 +204,6 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
return new ShutdownHandler(); return new ShutdownHandler();
} }
private LoggerConfig getRootLoggerConfig() {
return getLoggerContext().getConfiguration().getLoggerConfig("");
}
private LoggerConfig getLoggerConfig(String name) { private LoggerConfig getLoggerConfig(String name) {
name = (StringUtils.hasText(name) ? name : LogManager.ROOT_LOGGER_NAME); name = (StringUtils.hasText(name) ? name : LogManager.ROOT_LOGGER_NAME);
return getLoggerContext().getConfiguration().getLoggers().get(name); return getLoggerContext().getConfiguration().getLoggers().get(name);
......
...@@ -194,6 +194,13 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { ...@@ -194,6 +194,13 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
assertThat(fileContents).is(Matched.by(expectedOutput)); assertThat(fileContents).is(Matched.by(expectedOutput));
} }
@Test
public void beforeInitializeFilterDisablesErrorLogging() throws Exception {
this.loggingSystem.beforeInitialize();
assertThat(this.logger.isErrorEnabled()).isFalse();
this.loggingSystem.initialize(null, null, getLogFile(null, tmpDir()));
}
@Test @Test
public void customExceptionConversionWord() throws Exception { public void customExceptionConversionWord() throws Exception {
System.setProperty("LOG_EXCEPTION_CONVERSION_WORD", "%ex"); System.setProperty("LOG_EXCEPTION_CONVERSION_WORD", "%ex");
......
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