Logger: isLoggable(Level level) : Logger « java.util.logging « Java by API
- Java by API
- java.util.logging
- Logger
Logger: isLoggable(Level level)
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
public static void main(String[] argv) throws Exception {
Logger logger = Logger.getLogger("com.mycompany.MyClass");
// Check if the message will be logged
if (logger.isLoggable(Level.FINEST)) {
logger.finest("my finest message");
}
}
}
Related examples in the same category