log4j.xml 异常: "log4j:configuration" must match "(renderer*,appender*,(category|logger)*......问题分析及解决

 

使用log4j.xml进行log4j的配置,在项目中报如下异常:

log4j:ERROR The content of element type "log4j:configuration" must match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)".

 

异常分析:

log4j.xml中相关元素的位置不正确

 

配置文件定位及解决:

经对比,发现项目log4j.xml中“<appender></appender>”放到了“logger></logger>”的后边,

将“logger></logger>”调整到所有“<appender></appender>”的前边,并重启项目问题得以解决。

 

 

网络参考:

log4j.xml警告log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appen

参考url:http://blog.csdn.net/yizhizouxiaqu/article/details/7208693

原因log4j.xml中文件的位置不对,顺序为:

<renderer></renderer>
<renderer></renderer>
<renderer></renderer>
<appender></appender>
<appender></appender>
<appender></appender>
<plugin></plugin>
<plugin></plugin>
<plugin></plugin>
<logger></logger>
<logger></logger>
<logger></logger>
<category></category>
<category></category>
<category></category>
<root></root>
<root></root>
<root></root>
<loggerfactory></loggerfactory>
<loggerfactory></loggerfactory>
<loggerfactory></loggerfactory>
<categoryfactory></categoryfactory>
<categoryfactory></categoryfactory>
<categoryfactory></categoryfactory>

 

你可能感兴趣的:(log4j.xml 异常: "log4j:configuration" must match "(renderer*,appender*,(category|logger)*......问题分析及解决)