In the past, i used to spring 4.3.8 version, i used to Log4j config in web.xml like below code,
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:/log4j-${spring.profiles.active}.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Currently, i trying to use spring 5.0.7 version but, i can't use Log4jConfigListener
i realized Log4jConfigListener is not exist in spring 5.x version
I can use "log4j.xml"(default name) but i want to use custom name for sever,local environment
how can i do?
The Log4jConfigListener
has been removed as of Spring 4.2.1, in favor of Apache Log4j 2.
See the relevant information Spring 4.2.1 deprecation list:
org.springframework.web.util.Log4jConfigListener
as of Spring 4.2.1, in favor of Apache Log4j 2 (following Apache's EOL declaration for log4j 1.x)
You can configure environments in the XML file using Environment Lookup.
Just Remove the listener from web.xml and put log4j.properties file in your classpath. then you will get your result.
org.springframework.web.util.Log4jConfigListener is deprecated as of Spring 4.2.1, in favor of Apache Log4j 2 (following Apache's EOL declaration for log4j 1.x)
as an alternate you can change your configuration to use org.apache.logging.log4j.web.Log4jServletContextListener (log4j-web) More details can be found here https://logging.apache.org/log4j/2.x/manual/webapp.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With