plutext / docx4j

JAXB-based Java library for Word docx, Powerpoint pptx, and Excel xlsx files
https://www.docx4java.org/
2.13k stars 1.2k forks source link

Excessive logs on startup #564

Open cowwoc opened 1 year ago

cowwoc commented 1 year ago

Version 11.4.9

14:58:57.147 [main-5] INFO  org.docx4j.XmlUtils.<clinit>() - setProperty com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl (from docx4j.properties)
14:58:57.148 [main-5] WARN  org.docx4j.XmlUtils.<clinit>() - actual SAXParserFactory: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
14:58:57.150 [main-5] INFO  org.docx4j.XmlUtils.<clinit>() - setProperty com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl (from docx4j.properties)
14:58:57.152 [main-5] WARN  org.docx4j.XmlUtils.<clinit>() - actual DocumentBuilderFactory: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

I suggest using DEBUG level logging for this stuff. As far as I can tell, there is nothing to warn about here. Even INFO is a bit excessive given that the code is just confirming that the configuration is being applied. If I had configuration problems, I'd enable DEBUG.

xulongZheng commented 6 months ago

You can eliminate dependencies on built-in logging when introducing docx4j

`

org.docx4j
    <artifactId>docx4j-ImportXHTML</artifactId>
    <version>8.3.10</version>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
</dependency>`

This method can reduce the log output at startup, but when using docx4j, there will be many logs, you can change the docx4j log level to ERROR in your own log configuration file。