Log4j的使用方法
有时会出现log4j.properties无法加载的情况,
检测有没有加载在jvm中加参数-Dlog4j.debug
解决的方案是,在web.xml中加Log4jConfigListener监听器,注意这个监听器要放在spring监听器之前。
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:config/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>