web.xml log4j的配置

    <!-- log4j 配置  开始 -->
    <context-param>
        <param-name>log4jConfigLocation</param-name>
		<param-value>/WEB-INF/classes/com/avicit/resource/log4j/log4j.properties</param-value>
    </context-param>
    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>600000</param-value>
    </context-param>
    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>fes.root</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <!-- log4j 配置  结束 -->
log4jConfigLocation

配置文件存放的位置

log4jRefreshInterval为60000表示 开一条watchdog线程每60秒扫描一下配置文件的变化;这样便于日志存放位置的改变

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>fes.root</param-value>
    </context-param>
这里如果tomcat存放多个项目的时候,最好写了下,防止记录日志的文件写到当前项目的路径中!

<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
利用spring的监听器!

你可能感兴趣的:(web.xml log4j的配置)