在web.xml上添加如下配置即可动态监听log4j.properties的变化
<!-- 需要监听的log4j文件地址 -->! <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</param-value> </context-param> <!-- 监听log4j.properties --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>