默认设置:Log4j配置文件放在src下则可以被log4j.jar读取到。
如果想要把log4j.properties文件迁移到项目的其他位置,则可以做如下配置:
<!-- 设置由Spring载入的Log4j配置文件位置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>WEB-INF/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>