I have a simple console app which uses apache\'s PDFBox library, which in turn uses commons logging. I\'m getting a lot of junk messages in my console which I\'d like to sup
In case you have no time to figure out which Logging implementation is used underneath by the Apache commons-logging, try to disable all that are in you classpath. Following code tests three implementations.
If any of the lines doesn't compile, do not add the dependency! Just remove the line.
String[] loggers = { "org.apache.pdfbox.util.PDFStreamEngine",
"org.apache.pdfbox.pdmodel.font.PDSimpleFont", "httpclient.wire.header" , "httpclient.wire.content"
for (String ln : names) {
// Try java.util.logging as backend
java.util.logging.Logger.getLogger(ln).setLevel(java.util.logging.Level.WARNING);
// Try Log4J as backend
org.apache.log4j.Logger.getLogger(ln).setLevel(org.apache.log4j.Level.WARN);
// Try another backend
Log4JLoggerFactory.getInstance().getLogger(ln).setLevel(java.util.logging.Level.WARNING);
}