Code example for ConsoleHandler

Methods: setFormattersetLevel

0
 
public class Debug { 
  public static Logger LOGGER = Logger.getLogger("toyThreads");
 
  static { 
    Handler handler = new ConsoleHandler();
    handler.setLevel(Level.ALL);
    handler.setFormatter(new LogFormatter());
    Debug.LOGGER.addHandler(handler);
    Debug.LOGGER.setUseParentHandlers(false);
  } 
 
  private Debug() {} 
 
  /** 
   * Sets the log level to the given level, or, if invalid, level 5. 
   * 
   * @param l The level to set logging to, between 5 and 10. 
   */ 
  public static void setLogLevel(int l) {