/** * Returns whether or not a message of the specified level would be logged by this logger. * * @throws NullPointerException if <code>level</code> is <code>null</code>. */ public boolean isLoggable(Level level) { synchronized (lock) { if (this.level != null) return this.level.intValue() <= level.intValue(); if (parent != null) return parent.isLoggable(level); else return false; } }
/** * Sets the level on {@code logger} to {@code newLevel}. Any child loggers currently inheriting * their level from {@code logger} will be updated recursively. * * @param newLevel the new minimum logging threshold. If null, the logger's parent level will be * used; or {@code Level.INFO} for loggers with no parent. */ synchronized void setLevelRecursively(Logger logger, Level newLevel) { int previous = logger.levelIntVal; logger.levelObjVal = newLevel; if (newLevel == null) { logger.levelIntVal = logger.parent != null ? logger.parent.levelIntVal : Level.INFO.intValue(); } else { logger.levelIntVal = newLevel.intValue(); } if (previous != logger.levelIntVal) { for (Logger child : logger.children) { if (child.levelObjVal == null) { setLevelRecursively(child, null); } } } }
static boolean shouldLog(Level level) { return verbose || level.intValue() >= minLogLevel; }