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"); } } }