📄 e396. getting the log level of a logger.txt
字号:
The log level of a logger controls how severe a log record must be before the logger accepts it. In particular, a log record whose level is greater than or equal to the logger's log level is logged.
A log level can be null, in which case the level is inherited from the logger's parent.
This example implements a method that returns the level of a logger. If the level is null, the method looks for an ancestor with a non-null level.
// Return the level of the specified logger.
// If the level of logger is null, the level of the closest
// ancestor with a non-null level is returned.
public static Level getLevel(Logger logger) {
Level level = logger.getLevel();
while (level == null && logger.getParent() != null) {
logger = logger.getParent();
level = logger.getLevel();
}
return level;
}
Related Examples
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -