Code example for SimpleFormatter

0
//        logger = Logger.getLogger("MyLog"); 
        try {     // This block configure the logger with handler and formatter 
         fh = new FileHandler(path, true);
         logger.addHandler(fh);
         logger.setLevel(Level.ALL);
         SimpleFormatter formatter = new SimpleFormatter();
         fh.setFormatter(formatter);
 
       } catch (SecurityException e) {
//         e.printStackTrace(); 
       } catch (IOException e) {
//         e.printStackTrace(); 
       } 
     } 
 
    public void log(Level warning, String s) {
        logger.log(warning, s);
    } 
}