diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index 8f053e2563..b11d32ad23 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -87,7 +87,7 @@
2.4.7
2.3.13
2.4.7.Final
- 2.3.4
+ 2.3.3
2.21
4.1.2
4.5.2
diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
index a7698213c3..5aad85009b 100644
--- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
+++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
@@ -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();
}
diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
index 3a050486ac..cf2aac58f4 100644
--- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
+++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
@@ -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);
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
index 13fdb557b4..d81b926e84 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java
@@ -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");