Logger: isLoggable(Level level) : Logger « java.util.logging « Java by API






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

1.Logger: addHandler(Handler handler)
2.Logger: config(String msg)
3.Logger: exiting(String sourceClass, String sourceMethod, Object result)
4.Logger: fine(String msg)
5.Logger: finer(String msg)
6.Logger: finest(String msg)
7.Logger: getAnonymousLogger()
8.Logger: getLogger(String name)
9.Logger: info(String msg)
10.Logger: logp(Level level, String sourceClass, String sourceMethod, String msg)
11.Logger: severe(String msg)
12.Logger: setFilter(Filter newFilter)
13.Logger: setUseParentHandlers(boolean useParentHandlers)
14.Logger: warning(String msg)