Is there a Apache Commons / Log4J logging API method which can be used to disable all logging completely, even for loggers which are in third party libraries?
Background: I would like to use java.util.logging in a GlassFish v3 web application. However, a third party library in this web app uses Log4J logging and Apache Commons Logging. To save resources, this logging should be minimized or switched off.
Jakarta Commons logging is a wrapper around Log4j (Log4jLogger), the Java native logging system(Jdk14Logger) and the built-in fall-back logger SimpleLog. Depending on which one is on the classpath, that logging system is addressed transparently via the easy-to-learn commons logging API.
log4j is a logging framework, i.e. it provides the code to log messages. Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself.
Edit your log4j configuration and set the logging level to ERROR or FATAL
Example for Hibernate:
log4j.logger.org.hibernate=ERROR
This will dwarf the logging output to almost zero, leaving only critical error messages.
you can just raise the log threshold by package for the external libraries. I don't know about turning it off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With