- All Superinterfaces:
PlatformManagedObject
The management interface for the logging facility.
Precisely one instance of this interface will be made available to management clients.
Accessing this MXBean
can be done in one of three ways.
- Invoking the static
ManagementFactory.getPlatformMXBean(java.lang.Class<T>)
method. - Using a javax.management.MBeanServerConnection.
- Obtaining a proxy MXBean from the static
ManagementFactory.newPlatformMXBeanProxy(javax.management.MBeanServerConnection, java.lang.String, java.lang.Class<T>)
method, passing in "java.util.logging:type=Logging" for the value of the second parameter.
- Since:
- 1.5
-
Method Summary
Modifier and TypeMethodDescriptiongetLoggerLevel
(String loggerName) Returns the string name of the specifiedLogger
instance's current log level.Returns a list of the names of all of the currently registeredLogger
instances.getParentLoggerName
(String loggerName) void
setLoggerLevel
(String loggerName, String levelName) Methods declared in interface java.lang.management.PlatformManagedObject
getObjectName
-
Method Details
-
getLoggerLevel
Returns the string name of the specifiedLogger
instance's current log level.- Parameters:
loggerName
- the name of a particularLogger
instance- Returns:
- if
loggerName
resolves to an existing registeredLogger
instance, the log level of that instance. Note that if it is the case that theLogger
just inherits its log level rather than specifying its own, then an empty string (""
) will be returned. IfloggerName
does not resolve to a registered instance ofLogger
then anull
value is returned.
-
getLoggerNames
Returns a list of the names of all of the currently registeredLogger
instances.- Returns:
- a list of the names of all registered
Logger
objects.
-
getParentLoggerName
- Parameters:
loggerName
- the name of a particularLogger
instance- Returns:
- if
loggerName
resolves to an existing registeredLogger
instance, the name of its parentLogger
. If theLogger
is the root entry in theLogger
hierarchy, then an empty string (""
) will be returned. IfloggerName
does not resolve to a registered instance ofLogger
then anull
value is returned.
-
setLoggerLevel
Attempts to update the log level of theLogger
with nameloggerName
tolevelName
.If
levelName
isnull
then theLogger
instance's log level is set to benull
with the result that it will inherit its log level from its nearest parent which does not have anull
log level value.- Parameters:
loggerName
- the name of a registeredLogger
levelName
- the name of the new log level. May benull
, in which caseloggerName
will inherit the log level of its closest parent with a non-null
log level.- Throws:
IllegalArgumentException
- if there is noLogger
with the nameloggerName
. Also may be thrown ifloggerName
is not a known log level name.SecurityException
- if there is a security manager active and the caller does not haveLoggingPermission
of "control".
-