Aisce
日历
<
2025年4月
>
日
一
二
三
四
五
六
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
统计
随笔 - 1
文章 - 0
评论 - 0
引用 - 0
导航
BlogJava
首页
发新随笔
发新文章
联系
聚合
管理
常用链接
我的随笔
我的评论
我的参与
留言簿
给我留言
查看公开留言
查看私人留言
随笔分类
Log4j
(rss)
随笔档案
2012年12月 (1)
搜索
最新评论
2012年12月9日
WARN No appenders could be found for logger的解决方法
在spring的web项目中常常会在tomcat启动的时候出现这种提示:
引用
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
网上有好多解决办法都不管用,这个提示应该是读入web应用程序的log4j.properties文件之前就报出来了。是在加载org.springframework.web.context.ContextLoader这个listener的时候没找到log4j的配置文件造成的。
仔细查看web.xml发现在加载org.springframework.web.context.ContextLoader这个listener之后才加载org.springframework.web.util.Log4jConfigListener,把log4j的配置放到org.springframework.web.context.ContextLoader之前,就可以解决这个问题了。
Xml代码
1
.
<!--
以下3项参数与log4j的配置相关
-->
2
.
3
.
<
context
-
param
>
4
.
<
param
-
name
>
log4jConfigLocation
</
param
-
name
>
5
.
<
param
-
value
>/
WEB
-
INF
/
log4j.properties
</
param
-
value
>
6
.
</
context
-
param
>
7
.
8
.
<
context
-
param
>
9
.
<
param
-
name
>
log4jRefreshInterval
</
param
-
name
>
10
.
<
param
-
value
>
60000
</
param
-
value
>
11
.
</
context
-
param
>
12
.
<
listener
>
13
.
<
listener
-
class
>
14
. org.springframework.web.util.Log4jConfigListener
15
.
</
listener
-
class
>
16
.
</
listener
>
17
.
<!--
end
-->
18
.
19
.
<
listener
>
20
.
<
listener
-
class
>
21
. org.springframework.web.context.ContextLoaderListener
22
.
</
listener
-
class
>
23
.
</
listener
>
posted @
2012-12-09 23:04
Aisce.lin 阅读(337) |
评论 (0)
|
编辑
收藏
仅列出标题
Copyright © Aisce.lin
Powered by:
博客园
模板提供:
沪江博客