tags:

views:

75

answers:

1

When I got a new logger it always had the level set to INFO but the documentation told otherwise (null), Hence I opened the code. The documentation and the code doesnt match. I am putting it on stackoverflow for others dont have to struggle

    /**
 * Protected method to construct a logger for a named subsystem.
 * <p>
 * The logger will be initially configured with a null Level
 * and with useParentHandlers true.
 *
 * @param   name A name for the logger.  This should
 *     be a dot-separated name and should normally
 *     be based on the package name or class name
 *     of the subsystem, such as java.net
 *     or javax.swing.  It may be null for anonymous Loggers.
 * @param   resourceBundleName  name of ResourceBundle to be used for localizing
 *     messages for this logger.  May be null if none
 *     of the messages require localization.
 * @throws MissingResourceException if the ResourceBundleName is non-null and
 *      no corresponding resource can be found.
 */
protected Logger(String name, String resourceBundleName) {
if (resourceBundleName != null) {
    // Note: we may get a MissingResourceException here.
    setupResourceInfo(resourceBundleName);
}
this.name = name;
levelValue = Level.INFO.intValue();
}
+1  A: 

Look at this, in Logger Javadoc :

Each Logger has a "Level" associated with it. This reflects a minimum Level that this logger cares about. If a Logger's level is set to null, then its effective level is inherited from its parent, which may in turn obtain it recursively from its parent, and so on up the tree.

And in LogManager Javadoc : The root logger's level is set to Level.INFO

But I'm agree that the Logger Javadoc should be clearer.

Nettogrof