读书人

spring集成log4j

发布时间: 2013-02-25 10:23:36 作者: rapoo

spring集成log4j .
1、 log4j.properties文件

1)文件位置:在src下面

2)文件配置







3、 web.xml配置

<!--如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"--> <context-param>  <param-name>webAppRootKey</param-name>  <param-value>ssh.root</param-value> </context-param>这里的ssh是http://localhost:8080/ssh/而root是系统开发目录中ssh/root<!--由Sprng载入的Log4j配置文件位置--> <context-param>  <param-name>log4jConfigLocation</param-name>  <param-value>/WEB-INF/log4j.properties</param-value> </context-param><!--Spring默认刷新Log4j配置文件的间隔,单位为millisecond--> <context-param>  <param-name>log4jRefreshInterval</param-name>  <param-value>60000</param-value> </context-param><!--Spring log4j Config loader--> <listener>  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>

读书人网 >开源软件

热点推荐