You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2020/02/15 23:07:50 UTC
[logging-log4j2] branch master updated: call
#StatusLogger.getLogger() only when it's needed. (#300)
This is an automated email from the ASF dual-hosted git repository.
rgoers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new b6151de call #StatusLogger.getLogger() only when it's needed. (#300)
b6151de is described below
commit b6151de9de9c0e5b8ddca52d75e2dc7ac1ff1085
Author: qxo <qx...@gmail.com>
AuthorDate: Sun Feb 16 07:07:43 2020 +0800
call #StatusLogger.getLogger() only when it's needed. (#300)
when Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED=true should not invoke #StatusLogger.getLogger() in Log4jServletContainerInitializer
Otherwise there will be initialization issue: custom config issue
---
.../apache/logging/log4j/web/Log4jServletContainerInitializer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContainerInitializer.java b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContainerInitializer.java
index aad1b63..19ac246 100644
--- a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContainerInitializer.java
+++ b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContainerInitializer.java
@@ -34,14 +34,14 @@ import org.apache.logging.log4j.status.StatusLogger;
*/
public class Log4jServletContainerInitializer implements ServletContainerInitializer {
- private static final Logger LOGGER = StatusLogger.getLogger();
-
@Override
public void onStartup(final Set<Class<?>> classes, final ServletContext servletContext) throws ServletException {
if (servletContext.getMajorVersion() > 2 && servletContext.getEffectiveMajorVersion() > 2 &&
!"true".equalsIgnoreCase(servletContext.getInitParameter(
Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED
))) {
+ final Logger LOGGER = StatusLogger.getLogger();
+
LOGGER.debug("Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment.");
final FilterRegistration.Dynamic filter =