log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

WARN No appenders could be found for logger的解决办法。

做一个SpringMVC+Maven的Web项目,tomcat启动时出现以下问题:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.

在网上查了一下,多是说把ContextLoaderListener改为SpringContextServlet,但我这样改了没用。

后来在stackoverflow看到一个遇到同样问题的帖子,他是这样改的:(将下面的代码添加到)

<context-param>
   <param-name>log4jConfigLocation</param-name>
   <param-value>/WEB-INF/config/log4j.properties</param-value>
</context-param>

······

<!-- 定义LOG4J监听器 -->
<listener>
   <listener-class>
org.springframework.web.util.Log4jConfigListener
   </listener-class>
</listener>

这样改了问题就解决了,不用再修改ContextLoaderListener。

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader)._第1张图片

你可能感兴趣的:(log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).)