flyingsaucerproject / flyingsaucer

XML/XHTML and CSS 2.1 renderer in pure Java
Other
1.95k stars 549 forks source link

Internal logging is enabled by default contrary to what doc says #304

Closed etiennebrateau closed 1 month ago

etiennebrateau commented 3 months ago

The documentation says that internal logging is disabled by default (logging doc) But if the config file is not found (my case), the default value in the code is to enable internal logging (https://github.com/flyingsaucerproject/flyingsaucer/blob/main/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/XRLog.java#L245C13-L245C36)

asolntsev commented 2 months ago

@etiennebrateau @gerpres Holy shit! :) I also spent some time for searching related changes in github, but finally I found this uncommitted file in my IDEA:

image

Thank you for reporting, I will revert it in the next FS release.

gerpres commented 2 months ago

thx for investigating.

I tried a local workaround for #304 but programmatically disabling logoutput via XRLog.setLoggingEnabled(false) didn't work, since XRLog.init() resets the flag based on the config-file. I had to pass a custom XRLogger-implementation to be able to control if/where log-statements are visible.

BTW if you actually want to enable logging, and are running inside an application that's already using some different logging-stack (e.g. slf4j) it's pretty awkward to reconfigure flyingsaucer-logging, since the default JDKXRLogger does explicit re-configs on it's loggers, and e.g. by default adds java.util.logging.ConsoleHandler which results in flyingsaucer logs bypassing global configuration done via. e.g. https://www.slf4j.org/apidocs/org/slf4j/bridge/SLF4JBridgeHandler.html

asolntsev commented 1 month ago

will be fixed in 9.8.0

ivangal2 commented 1 month ago

When will this version appear in https://mvnrepository.com/artifact/org.xhtmlrenderer/flying-saucer-pdf-itext5?

asolntsev commented 1 month ago

@ivangal2 Please read release notes for 9.8.0: https://github.com/flyingsaucerproject/flyingsaucer/releases/tag/v9.8.0 It says: "Remove itext 5 support (#325)". So the artefact "flying-saucer-pdf-itext5" will not be released anymore. Please use "flying-saucer-pdf" instead.