gpt4 book ai didi

java - log4j:WARN 在 web.xml 中找不到记录器的附加程序

转载 作者:IT老高 更新时间:2023-10-28 11:46:55 29 4
gpt4 key购买 nike

我已经将 log4jConfigLocation 放在 web.xml 中,但我仍然收到以下警告:

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 文件,那么您似乎从未真正创建过记录器。你需要这样一行:

log4j.rootLogger=debug,A1

关于java - log4j:WARN 在 web.xml 中找不到记录器的附加程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1266139/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com