Ich teste Log4j2 und ich weiß nicht, was ich falsch mache, weil ich die Bibliothek von Apache heruntergeladen und sie in den Klassenpfad abgelegt habe . Ich habe die XercesImpl, Xalan, Xml-Apis, Serializer, Xsltc auch hinzugefügt und die Ausnahme weiterhin bestehen. Ich zeige die Stack-Trace und die Konfigurationsdatei:Problem http://apache.org/xml/features/xinclude testet log4j 2
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Properties>
<Property name="log-path">C:/Logs/</Property>
</Properties>
<Appenders>
<RollingFile name="RollingFile" fileName="${log-path}/myexample.log"
filePattern="${log-path}/myexample-%d{yyyy-MM-dd}-%i.log">
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="1 KB" />
</Policies>
<DefaultRolloverStrategy max="4" />
</RollingFile>
</Appenders>
<Loggers>
<Logger name="root" level="debug" additivity="false">
<appender-ref ref="RollingFile" level="debug" />
</Logger>
<Root level="debug" additivity="false">
<AppenderRef ref="RollingFile" />
</Root>
</Loggers>
</Configuration>
ERROR StatusLogger Error parsing C:\W7des\cliente\Test\bin\log4j2.xml javax.xml.parsers.ParserConfigurationException: Feature 'http://apache.org/xml/features/xinclude' is not recognized.
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at org.apache.logging.log4j.core.config.xml.XmlConfiguration.newDocumentBuilder(XmlConfiguration.java:85)
at org.apache.logging.log4j.core.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:137)
at org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory.getConfiguration(XmlConfigurationFactory.java:44)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:472)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:442)
at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:254)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:419)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:207)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:160)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:492)
at pac.Main.<clinit>(Main.java:14)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
Vielen Dank im Voraus.
Zuerst habe ich ohne zusätzliche Bibliotheken getestet und der Fehler war der gleiche. Dann nahm ich die letzte Version von Xerces (2.11) und Xalan (2.7.1). Obwohl ich sie entferne, besteht das Problem immer noch. Die eindeutigen Nachrichten, die ich in der Konsole sehe, sind: 'ERROR StatusLogger Fehler beim Analysieren von C: \ W7des \ Client \ Test \ bin \ log4j2.xml javax.xml.parsers.ParserConfigurationException: Feature 'http://apache.org/xml/features/xinclude 'wird nicht erkannt. ERROR StatusLogger Keine Protokollierungskonfiguration' Aber die Ausnahme ist über DocumentBuilderFactory ... –
Der Grund, warum ich nach den Warnungen fragte, ist, dass Log4j eine WARN-Nachricht ausgibt, wenn 'DocumentBuilderFactory.setXIncludeAware (true)' aus irgendeinem Grund fehlschlägt ... siehe auch: http://logging.apache.org/log4j/2.x/log4j-core/xref/org/apache/logging/log4j/core/config/xml/XmlConfiguration.html#L93 –
Ich habe die Eigenschaft 'true 'aber ich habe keine neuen Nachrichten erhalten ... Hier ist, wo ich denke, ist das Problem bei 'org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder (Unknown Source)'. Was könnte ich mehr tun? –