Code example for LogManager

Methods: readConfiguration, reset

0
    FileHandler handler;
    LogRecord r;
 
    protected void setUp() throws Exception { 
        super.setUp(); 
        manager.reset();
 
        //initProp 
        props.clear();
        props.put("java.util.logging.FileHandler.level", "FINE");
        props.put("java.util.logging.FileHandler.filter", className
                + "$MockFilter"); 
        props.put("java.util.logging.FileHandler.formatter", className
                + "$MockFormatter"); 
        props.put("java.util.logging.FileHandler.encoding", "iso-8859-1");
        // limit to only two message 
        props.put("java.util.logging.FileHandler.limit", "1000");
        // rotation count is 2 
        props.put("java.util.logging.FileHandler.count", "2");
        // using append mode 
        props.put("java.util.logging.FileHandler.append", "true");
        props.put("java.util.logging.FileHandler.pattern",
                        "%t/log/java%u.test"); 
 
        HOMEPATH = System.getProperty("user.home");
        TEMPPATH = System.getProperty("java.io.tmpdir");
 
        File file = new File(TEMPPATH + SEP + "log");
        file.mkdir();
        manager.readConfiguration(propertiesToInputStream(props));
        handler = new FileHandler();
        r = new LogRecord(Level.CONFIG, "msg");
    } 
 
    protected void tearDown() throws Exception {