Code example for FileHandler

Methods: setFormatter

0
    // Get the global logger to configure it 
    Logger logger = Logger.getLogger("testmylog");
 
    logger.setLevel(Level.INFO);
    fileTxt = new FileHandler("Logging.txt");
    fileHTML = new FileHandler("Logging.html");
 
    // Create txt Formatter 
    formatterTxt = new SimpleFormatter();
    fileTxt.setFormatter(formatterTxt);
    logger.addHandler(fileTxt);
 
    // Create HTML Formatter 
    formatterHTML = new MyHtmlFormatter();
    fileHTML.setFormatter(formatterHTML);
    logger.addHandler(fileHTML);
  } 
}