The rest of the app uses log4j and my understanding is that slf4j should be using the underlying log4j configuration. Here's my log4j2.xml file:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="outputLog">C:\temp\test.log</Property>
</Properties>
<Appenders>
<RollingFile name="Test_Appender" fileName="${outputLog}" filePattern="${outputLog}.%i" bufferedIO="false">
<PatternLayout>
<Pattern>%d [%T] [%p{length=1}]::%X::%c %m%n</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2048 KB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.docx4j" level="error" additivity="false">
<AppenderRef ref="Test_Appender"/>
</Logger>
</Loggers>
</Configuration>
The \temp\test.log file gets created so I know it's reading the XML config file, but nothing is written to it no matter what level I set the logger to. And regardless, I get many lines of output to stderr like:
- Code: Select all
[main] INFO org.docx4j.jaxb.Context - java.vendor=Oracle Corporation
[main] INFO org.docx4j.jaxb.Context - java.version=1.8.0_151
[main] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperSunInternal, which is suitable for Java 6
[main] INFO org.docx4j.jaxb.Context - Not using MOXy; using com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl
[main] INFO org.docx4j.jaxb.Context - Using Java 6+ JAXB implementation
[main] WARN org.docx4j.utils.ResourceUtils - Couldn't get resource: docx4j.properties
[main] WARN org.docx4j.Docx4jProperties - Couldn't find/read docx4j.properties; docx4j.properties not found via classloader.
[main] INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
[main] INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
[main] INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
[main] INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
[main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Detected WordProcessingML package
[main] INFO org.docx4j.openpackaging.io3.Load3 - Instantiated package of type org.docx4j.openpackaging.packages.WordprocessingMLPackage
[main] INFO org.docx4j.utils.XPathFactoryUtil - xpath implementation: org.apache.xpath.jaxp.XPathFactoryImpl
...
And so on for hundreds of lines. I want to suppress that stuff.
Can you point me in the right direction? Thanks.