log4j:WARN 在 web.xml 中找不到记录器的附加程序 [英] log4j:WARN No appenders could be found for logger in web.xml
本文介绍了log4j:WARN 在 web.xml 中找不到记录器的附加程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将 log4jConfigLocation 放在 web.xml 中,但我仍然收到以下警告:
I already put the log4jConfigLocation in web.xml, but I still get the following warning:
log4j:WARN No appenders could be found for logger ⤦
⤥ (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
我错过了什么?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>suara2</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>suara2</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
推荐答案
如果那是整个 log4j.properties 文件,那么看起来您实际上从未创建过记录器.你需要这样一行:
If that's the entire log4j.properties file it looks like you're never actually creating a logger. You need a line like:
log4j.rootLogger=debug,A1
这篇关于log4j:WARN 在 web.xml 中找不到记录器的附加程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文