My app uses many libraries and I'm using java.util.logging
for logging. I'd like to be able to set different logging levels for each library by doing something like:
org.datanucleus.*.level = WARNING
com.google.apphosting.*.level = WARNING
com.myapp.*.level = FINE
Is is possible?
java.util.logging. Provides the classes and interfaces of the JavaTM 2 platform's core logging facilities. javax.sql.rowset.spi. The standard classes and interfaces that a third party vendor has to use in its implementation of a synchronization provider.
All the supported logging systems can have the logger levels set in the Spring Environment (for example, in application. properties ) by using logging. level. <logger-name>=<level> where level is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or OFF.
The process of creating a new Logger in Java is quite simple. You have to use Logger. getLogger() method. The getLogger() method identifies the name of the Logger and takes string as a parameter.
You shouldn't use "*". A sample logging.properties could be such as:
handlers=java.util.logging.ConsoleHandler
.level=ALL
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
org.datanucleus.level=WARNING
org.datanucleus.handler=java.util.logging.ConsoleHandler
com.myapp.level=FINE
com.myapp.handler=java.util.logging.ConsoleHandler
And if all "org" level should be logged as WARNING then
org.level=WARNING
org.handler=java.util.logging.ConsoleHandler
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