Spring中使用LOG4J
时间:2006-12-31 来源:liulibo
1.在web.xml中添加上下文初始化参数
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>path</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
2.添加日志监听器
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
3.添加log4j.properties文件
获取日志文件输入路径${path}/WEB-INF
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>path</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
2.添加日志监听器
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
3.添加log4j.properties文件
获取日志文件输入路径${path}/WEB-INF
相关阅读 更多 +