![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e396. Getting the Log Level of a LoggerThe 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 This example implements a method that returns the level of a
logger. If the level is // 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; }
e397. Comparing Log Levels e398. Creating a Custom Log Level
© 2002 Addison-Wesley. |