“log4j:configuration”必须匹配“(渲染器... .loggerFactory)?)”

时间:2021-05-31 23:02:34

getting error, when deploying my war file to tomcat:

在将war文件部署到tomcat时出现错误:

log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,throwableRenderer?,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?)"

I googled around and found out that ordering of my log4j.xml could be wrong, but it should be correct.

我google了一下,发现我的log4j.xml的排序可能是错误的,但它应该是正确的。

<?xml version="1.0" encoding="UTF-8" ?>  
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">  

  <appender name="console" class="org.apache.log4j.ConsoleAppender">  
    <param name="Target" value="System.out"/>  
    <layout class="org.apache.log4j.PatternLayout">  
      <param name="ConversionPattern" value="%-5p %d %c %x - %m%n"/>  
    </layout>  
  </appender>  

  <root>  
    <priority value ="error" />  
    <appender-ref ref="console" />  
  </root>  

  <category name="org.springframework" additivity="false">  
    <priority value="info" />  
    <appender-ref ref="console" />  
  </category>  

</log4j:configuration>

Any suggestions?

有什么建议么?

1 个解决方案

#1


56  

According to the error message, the DTD expects all category elements to be ahead of the root element. You have them the wrong way round.

根据错误消息,DTD期望所有类别元素都位于根元素之前。你有他们错误的方式。

#1


56  

According to the error message, the DTD expects all category elements to be ahead of the root element. You have them the wrong way round.

根据错误消息,DTD期望所有类别元素都位于根元素之前。你有他们错误的方式。