*
The moose likes Other JSE/JEE APIs and the fly likes J2SE Logging - setting the log level of all children loggers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "J2SE Logging - setting the log level of all children loggers" Watch "J2SE Logging - setting the log level of all children loggers" New topic
Author

J2SE Logging - setting the log level of all children loggers

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Hi.
I am trying to set the log level of all loggers that start with say, 'com.foo' by setting it in logging.properties file.
But when I create a logger for 'com.foo.bar' , it still gets assigned the default logging level of INFO.

On the other hand, if I set the default log level using
.level= FINER
Then it works fine.

Am I missing something here? Cant I change the log level of all children of 'com.foo' at one place?

Thanks.

Sonny

[ August 24, 2004: Message edited by: Sonny Gill ]
[ August 26, 2004: Message edited by: Sonny Gill ]

The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

To make it a bit more specific,



The above code prints

null
Parent - FINE
INFO: info

Now if the level for logger is null, shouldnt it inherit the level from its parent which is set to Logger.FINE?

But it is not logging the String passed in logger.fine("fine"), why?

Sonny

Should this thread by in the 'Intermediate Java' forum instead of here, since logging is part of J2SE now!
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Finally figured it out!!

Had to change the level of the console handler, which is the set to INFO by default in logging.properties
 
 
subject: J2SE Logging - setting the log level of all children loggers
 
Similar Threads
Using Properties instead of HashMap when dealing with Strings
java.util.Logging configuration
logging in SUN AS and JSR047
I can't seem to set the log level on my package
Refactoring - consequences of changing methods to static