参考:https://issues.apache.org/jira/browse/LOG4J2-411
Support of XSD/DTD linked to the configuration file
It would be very nice, if the the XML configuration uses an dedicated namespace, e.g. http://logging.apache.org/log4j/2.0/config.
This feature allows using XML catalogs to locate the schema locally, e.g. with Eclipse IDE.
The Log4j-events.xsd contains already such a declaration:
targetNamespace="http://logging.apache.org/log4j/2.0/events"
Then the configuration XML file needs only a small extension:
log4j2.xml
<?xml version="1.0" encoding="utf-8"?> <Configuration status="WARN" xmlns="http://logging.apache.org/log4j/2.0/config"> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> </Console> </Appenders> <Loggers> <Root level="error"> <AppenderRef ref="Console" /> </Root> </Loggers> </Configuration>