本文只针对非Maven环境:
1.拷入log4j相关的.jar
2.在web.xml中配置
<!--由Spring载入的Log4j配置文件位置-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<!--Spring log4j Config loader-->
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
3.测试一下