import java.util.logging.Level; import java.util.logging.Logger; public class MyLogger { private static final Logger logger = Logger.getLogger(MyLogger.class.getName()); public void myMethod() { // checking if DEBUG level is enabled if (logger.isDebugEnabled()) { logger.log(Level.INFO, "Entering myMethod"); } // do some processing here // logging a message logger.log(Level.WARNING, "Something went wrong"); } }In the above code, isDebugEnabled() is used to check if the logging level is set to DEBUG. If it is, then the message "Entering myMethod" will be logged with INFO level. If not, this block of code will not be executed. After the block of code execution, a WARNING level message "Something went wrong" is logged. Overall, the Logger class is a powerful logging tool in Java, and isDebugEnabled() is a handy method for checking DEBUG level in logging.