可以在web.xml中指定加载log4j的配置文件。
配置如下:
<!– 配置log4j日志加载文件 log4j.properties –>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webapp.devportal</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>60000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/196499.html