问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/53868470/spring-5-how-to-use-log4jconfiglistener