Code example for FileHandler

Methods: setFormatter

0
        try { 
            // 
            // Creating an instance of FileHandler with 5 logging files 
            // sequences. 
            // 
            FileHandler handler = new FileHandler("myapp.log", FILE_SIZE, 5, true);
            handler.setFormatter(new SimpleFormatter());
            logger.addHandler(handler);
            logger.setUseParentHandlers(false);
        } catch (IOException e) {
            logger.warning("Failed to initialize logger handler.");
        } 
 
        logger.info("Logging information message.");
        logger.warning("Logging warning message.");
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE