Package java.util.logging
Interface LoggingMXBean
public interface LoggingMXBean
LoggingMXBean is the management interface for the logging sub-system.
The ObjectName for identifying the LoggingMXBean in a bean server is
LogManager.LOGGING_MXBEAN_NAME.
- Since:
- 1.5
-
Method Summary
Modifier and Type Method Description StringgetLoggerLevel(String loggerName)Gets the string value of the logging level of a logger.List<String>getLoggerNames()Gets a list of all currently registered logger names.StringgetParentLoggerName(String loggerName)Gets the name of the parent logger of a logger.voidsetLoggerLevel(String loggerName, String levelName)Sets the log level of a logger.
-
Method Details
-
getLoggerLevel
Gets the string value of the logging level of a logger. An empty string is returned when the logger's level is defined by its parent. Anullis returned if the specified logger does not exist.- Parameters:
loggerName- the name of the logger lookup.- Returns:
- a
Stringif the logger is found, otherwisenull. - See Also:
Level.getName()
-
getLoggerNames
Gets a list of all currently registered logger names. This is performed using theLogManager.getLoggerNames().- Returns:
- a list of logger names.
-
getParentLoggerName
Gets the name of the parent logger of a logger. If the logger doesn't exist thennullis returned. If the logger is the root logger, then an emptyStringis returned.- Parameters:
loggerName- the name of the logger to lookup.- Returns:
- a
Stringif the logger was found, otherwisenull.
-
setLoggerLevel
Sets the log level of a logger. LevelName set tonullmeans the level is inherited from the nearest non-null ancestor.- Parameters:
loggerName- the name of the logger to set the level on, which must not benull.levelName- the level to set on the logger, which may benull.- Throws:
IllegalArgumentException- ifloggerNameis not a registered logger or iflevelNameis not null and not valid.- See Also:
Level.parse(String)
-