java.util.logging does NOT respect logging level

For some reason you are using j.u.l instead of log4j or slf4j. And you want to se your logs of level LOWER than WARNING. You’ve done even logger.setLevel(Level.ALL); and yet nothing below WARNING is ever printed out. You’ve checked the logging method and they are the same. WTH?!!

Well, set console handler log level, cause in j.u.l log level is the minimum of logger and handler level. To do that, put in your properties file:

java.util.logging.ConsoleHandler.level = FINEST

Or, if – like me – you wish the console handler would just follow logger level, set it to FINEST or ALL in global (JDK) settings:

sudo vim /usr/lib/jvm/default-java/jre/lib/logging.properties

The file is write-protected, so sudo.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s