spring-mvc – Log4j,Spring MVC,没有可用于记录器的appender

栏目: Java · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/9691456/log4j-spring-mvc-no-appenders-could-be-found-for-logger

log4j工作正常,但是,在服务器启动时,我收到这些警告:

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

这意味着无法找到log4j.properties.但我不知道如何解决这个问题,因为一切似乎都很好.

将spring Log4jConfigListener作为web.xml中的第一个侦听器.

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

您可以在上下文参数中设置upp log4j属性的位置,但如果它放在类路径上则不需要这样做.

一个例子是……

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

翻译自:https://stackoverflow.com/questions/9691456/log4j-spring-mvc-no-appenders-could-be-found-for-logger


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head Rush Ajax

Head Rush Ajax

Brett McLaughlin、Eric Freeman、Elisabeth Freeman / O'Reilly Media, Inc. / 2006-03-01 / USD 34.99

Ajax, or Asynchronous JavaScript and XML, is a term describing the latest rage in web development. Ajax is used to create interactive web applications with XML-based web services, and using JavaScript......一起来看看 《Head Rush Ajax》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具