2009-09-16 34 views
0

当我得到一个新的记录器时,它始终将级别设置为INFO,但文档中另有告知(空),因此我打开了代码。文档和代码不匹配。我把它放在计算器别人不要有奋斗java.util.logger构造函数描述bug或javadoc错误?

/** 
* 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

看看这个,在记录仪的Javadoc:

每个Logger都有一个与之关联的“级别”。这反映了该记录器关心的最低级别。如果记录器的级别设置为空,则其有效级别将从其父级继承,而后者又可从其父级递归获取,等等。

并在日志管理的Javadoc:根logger的级别设置为Level.INFO

但我同意,记录仪的Javadoc应该再清楚不过了。