Most visited

Recently visited

Added in API level 1

LoggingMXBean

public interface LoggingMXBean

java.util.logging.LoggingMXBean


日志记录工具的管理界面。

有一个单一的全球实例LoggingMXBean javax.management.ObjectName ObjectName唯一标识的管理界面进行日志记录的内MBeanServer是:

    java.util.logging:type=Logging
 

摘要(Summary)

公共方法(Public methods)

abstract String getLoggerLevel(String loggerName)

获取与指定记录器关联的日志级别的名称。

abstract List<String> getLoggerNames()

返回当前注册的记录器名称列表。

abstract String getParentLoggerName(String loggerName)

返回指定记录器的父项的名称。

abstract void setLoggerLevel(String loggerName, String levelName)

将指定的记录器设置为指定的新级别。

公共方法(Public methods)

getLoggerLevel

Added in API level 1
String getLoggerLevel (String loggerName)

获取与指定记录器关联的日志级别的名称。 如果指定的记录器不存在,则返回null 此方法首先查找给定名称的记录器,然后通过调用以下命令返回日志级别的名称:

Logger.getLevel(). getName();

如果指定logger的 Levelnull,这意味着此logger的有效级别从其父继承,一个空字符串将被退回。

参数(Parameters)
loggerName String: The name of the Logger to be retrieved.
返回(Returns)
String The name of the log level of the specified logger; or an empty string if the log level of the specified logger is null. If the specified logger does not exist, null is returned.

也可以看看:

getLoggerNames

Added in API level 1
List<String> getLoggerNames ()

返回当前注册的记录器名称列表。 此方法调用getLoggerNames()并返回记录器名称的列表。

返回(Returns)
List<String> A list of String each of which is a currently registered Logger name.

getParentLoggerName

Added in API level 1
String getParentLoggerName (String loggerName)

返回指定记录器的父项的名称。 如果指定的记录器不存在,则返回null 如果指定的记录器是名称空间中的根Logger ,则结果将是空字符串。

参数(Parameters)
loggerName String: The name of a Logger.
返回(Returns)
String the name of the nearest existing parent logger; an empty string if the specified logger is the root logger. If the specified logger does not exist, null is returned.

setLoggerLevel

Added in API level 1
void setLoggerLevel (String loggerName, 
                String levelName)

将指定的记录器设置为指定的新级别。 如果levelName不是null ,则指定记录器的级别设置为与levelName匹配的解析Level 如果levelNamenull ,则指定记录器的级别设置为null,并且记录器的有效级别将从具有特定(非空)级别值的最近的祖先继承。

参数(Parameters)
loggerName String: The name of the Logger to be set. Must be non-null.
levelName String: The name of the level to set on the specified logger, or null if setting the level to inherit from its nearest ancestor.
抛出异常(Throws)
IllegalArgumentException if the specified logger does not exist, or levelName is not a valid level name.
SecurityException if a security manager exists and if the caller does not have LoggingPermission("control").

也可以看看:

Hooray!