Merge branch '1.3.x'

This commit is contained in:
Phillip Webb
2016-07-18 14:35:56 -07:00
4 changed files with 14 additions and 12 deletions

View File

@@ -87,7 +87,7 @@
<hikaricp.version>2.4.7</hikaricp.version>
<hikaricp-java6.version>2.3.13</hikaricp-java6.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>
<httpasyncclient.version>4.1.2</httpasyncclient.version>
<httpclient.version>4.5.2</httpclient.version>

View File

@@ -693,7 +693,8 @@ public class TomcatEmbeddedServletContainerFactory
/**
* {@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 {
@@ -708,10 +709,8 @@ public class TomcatEmbeddedServletContainerFactory
private void onStart(Context context) {
ServletContext servletContext = context.getServletContext();
if (servletContext
.getAttribute(StoreMergedWebXmlListener.MERGED_WEB_XML) == null) {
servletContext.setAttribute(StoreMergedWebXmlListener.MERGED_WEB_XML,
getEmptyWebXml());
if (servletContext.getAttribute(MERGED_WEB_XML) == null) {
servletContext.setAttribute(MERGED_WEB_XML, getEmptyWebXml());
}
TomcatResources.get(context).addClasspathResources();
}

View File

@@ -130,13 +130,13 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
@Override
public void beforeInitialize() {
super.beforeInitialize();
getRootLoggerConfig().addFilter(FILTER);
getLoggerContext().getConfiguration().addFilter(FILTER);
}
@Override
public void initialize(LoggingInitializationContext initializationContext,
String configLocation, LogFile logFile) {
getRootLoggerConfig().removeFilter(FILTER);
getLoggerContext().getConfiguration().removeFilter(FILTER);
super.initialize(initializationContext, configLocation, logFile);
}
@@ -204,10 +204,6 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
return new ShutdownHandler();
}
private LoggerConfig getRootLoggerConfig() {
return getLoggerContext().getConfiguration().getLoggerConfig("");
}
private LoggerConfig getLoggerConfig(String name) {
name = (StringUtils.hasText(name) ? name : LogManager.ROOT_LOGGER_NAME);
return getLoggerContext().getConfiguration().getLoggers().get(name);

View File

@@ -194,6 +194,13 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
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
public void customExceptionConversionWord() throws Exception {
System.setProperty("LOG_EXCEPTION_CONVERSION_WORD", "%ex");