Code example for FileHandler

Methods: setFormatter

0
     
    public void save() throws IOException { 
        Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        logger.setLevel(Level.FINER); 
        SimpleDateFormat format = new SimpleDateFormat("dd/mm/YYYY_hh:mm:sss");
        fileHandler = new FileHandler("E:\\Logger\\"+format.format(new Date()) + "_log.html");
        formatter = new HtmlLogger();
        fileHandler.setFormatter(formatter);
	logger.addHandler(fileHandler);   
    } 
    public static FileHandler getFileHandler() {
	return fileHandler;
    } 
     
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE