为什么我从Log4J 1.2.17收到警告?我试图在我的java项目中使用log4j,但我一直收到以下警告。有谁能告诉我为什么?
警告:
log4j:WARN Continuable parsing error 2 and column 87
log4j:WARN Document root element "log4j:configuration", must match DOCTYPE root "null".
log4j:WARN Continuable parsing error 2 and column 87
log4j:WARN Document is invalid: no grammar found.
我的log4j.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<log4j:configuration xmlns:log4j = "http://jakarta.apache.org/log4j/" debug = "false">
<appender name = "FILE" class = "org.apache.log4j.RollingFileAppender">
<param name = "File" value = "test.log"/>
<param name = "MaxFileSize" value = "5MB"/>
<param name = "MaxBackupIndex" value = "50"/>
<layout class = "org.apache.log4j.PatternLayout">
<param name = "ConversionPattern" value = "[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n"/>
</layout>
</appender>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<category name = "org.uftwf">
<priority value = "debug"/>
</category>
<!--
<category name = "org.apache.catalina">
<priority value = "error"/>
</category>
<category name = "org.hibernate">
<priority value = "debug"/>
</category>
<category name="org.hibernate.SQL">
<priority value="TRACE"/>
</category>
<category name="org.hibernate.type">
<priority value="TRACE"/>
</category>
-->
<root>
<priority value = "warn"/>
<appender-ref ref = "console"/>
</root>
</log4j:configuration>
我知道它只是一个警告,但我想知道为什么我会得到它们并阻止它们来...谢谢
答案 0 :(得分:5)
您的<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
之前应该有<log4j:configuration
。