Code example for FileHandler

Methods: setFormatter

0
    private void initializeLogger() { 
        logger = Logger.getLogger(getLoggerHeader());
        if (file == null)
            file = VersionedFile.getFile(ctxt.get(), LOGFILE);
        try { 
            filehandler = new FileHandler(file.getAbsolutePath(), MAX_FILE_SIZE, 1, true);
            filehandler.setFormatter(new LogFormatter());
            logger.addHandler(filehandler);
        } catch (IOException e) {
            e.printStackTrace();
        } 
    } 
 
    private void handleIntent(Intent intent) {
        try { 
            handleStart(intent);
        } catch (NullPointerException e) {
            /* 
             * Ignore null intents: system uses them to stop after processing 
			 */ 
        }