Logger isLoggable() method in Java with Examples
isLoggable() method of a Logger class is used to return a response in boolean value which provides an answer to the query that if a message of the given level would actually be logged by this logger or not. This check is based on the Loggers effective level, which may be inherited from its parent.
public boolean isLoggable(Level level)
Parameters: This method accepts one parameter level which represents message logging level.
Return value: This method returns true if the given message level is currently being logged.
Below programs illustrate the isLoggable() method:
The Level.INFO is currently being logged - true
The Level.OFF is currently being logged - true
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.