Log4j warning when using log4j.xml

I am trying to convert my log4j.properties to log4j.xml because I need to use part of the filter function. I get a bunch of warnings when I run the application, I'm not quite sure how to solve them:

log4j:WARN Continuable parsing error 4 and column 69
log4j:WARN Attribute "threshold" for element type "log4j:configuration" has a default value and must be specified in a standalone document.
log4j:WARN Continuable parsing error 4 and column 69
log4j:WARN Attribute "debug" for element type "log4j:configuration" has a default value and must be specified in a standalone document.
log4j:WARN Continuable parsing error 4 and column 69
log4j:WARN Attribute "reset" for element type "log4j:configuration" has a default value and must be specified in a standalone document.
log4j:WARN Continuable parsing error 20 and column 23
log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?)".
log4j:WARN Unrecognized element param

I am just trying with a very simple log4j.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="A1" class="org.apache.log4j.ConsoleAppender">
        <param name="Threshold" value="INFO"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%-5p | %d{MM-dd-yyyy HH:mm:ss.SSS} | %t | %c(%L) - %m%n"/>
        </layout>
    </appender>
    <root>
        <priority value="INFO"/>
        <appender-ref ref="A1"/>
    </root>
</log4j:configuration>

Is there anything I missed here? thank!

+5
source share
2 answers

A stand-alone attribute, roughly speaking, declares that the content is not affected by any content outside the document. However, this is not the case in this case, since attributes have default values ​​that are specified in the external DTD.

+2
source

, "yes" xml . Standalone = "yes" ( ). , XML, log4j, XML-, dtd.

, , log4j.

+2

All Articles