You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Matt Sicker (Jira)" <ji...@apache.org> on 2021/07/20 14:47:00 UTC
[jira] [Commented] (LOG4J2-3127) Log4j2 auto-initialization for
servlet version 2.5
[ https://issues.apache.org/jira/browse/LOG4J2-3127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17384313#comment-17384313 ]
Matt Sicker commented on LOG4J2-3127:
-------------------------------------
If you don't want auto-initialization with the servlet context, you can remove log4j-web from your classpath. This jar is only useful when you want to run multiple log4j2 configurations in the same servlet container which seems to be a less common usage pattern these days what with embedding Tomcat or Jetty instead of deploying to them.
> Log4j2 auto-initialization for servlet version 2.5
> --------------------------------------------------
>
> Key: LOG4J2-3127
> URL: https://issues.apache.org/jira/browse/LOG4J2-3127
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Reporter: Suman
> Priority: Major
>
> Hi
> I have recently uplifted log4j version from 1.2.17 to *2.14.0 ,* Comparatively log4j 1.2.17 in log4j2 a new behavior is added which is *auto-initialization ,* We are using Servlet version 2.5 can someone help me to disable the auto-initialization because of this we are using un Expected results , I have followed the below link to implement
> [https://logging.apache.org/log4j/2.x/manual/webapp.html]
> And my web.xml looks as below
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> id="WebApp_ID" version="2.5">
> <display-name>CentricityPracticeWS</display-name>
> <listener>
> <listener- class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
> </listener>
> <filter>
> <filter-name>log4jServletFilter</filter-name>
> <filter-class>org.apache.logging.log4j.web.Log4jServletFilter</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>log4jServletFilter</filter-name>
> <url-pattern>/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> <dispatcher>ERROR</dispatcher>
> <dispatcher>ASYNC</dispatcher><!-- Servlet 3.0 w/ disabled auto-initialization only; not supported in 2.5 -->
> </filter-mapping>
> <context-param>
> <param-name>isLog4jAutoInitializationDisabled</param-name>
> <param-value>true</param-value>
> </context-param>
> <!-- init properties shared by entire application -->
> <!-- init properties shared by entire application -->
> <context-param>
> <param-name>earDeploymentDescriptorPath</param-name>
> <param-value>application.xml</param-value> </context-param>
> <listener>
> <listener-class>com.gehcit.cp.ws.infrastructure.configuration.ConfigurationLoaderListener</listener-class>
> </listener>
> <!-- bootstrap Log4j -->
> <!-- bootstrap Log4j -->
> <!-- Log4j refresh interval -->
> <context-param>
> <param-name>log4jRefreshInterval</param-name>
> <param-value>60000</param-value>
> </context-param>
> <context-param>
> <param-name>log4jExposeWebAppRoot</param-name>
> <param-value>false</param-value>
> </context-param>
> </web-app> </web-app>
> {code}
> With the above web.xml , auto-initialization disable is not happening
> Can you help you me to fix this
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)