rfa2.setFormatter(layout2);
rfa2.setFormatter((ExtendedFormatter)layout2);
    public void test2() throws Exception {        String datePattern = "yyyy-MM-dd_HH_mm_ss";        PatternFormatter layout1 = new PatternFormatter("%c{1} - %m%n");        RollingFileHandler rfa1 = new RollingFileHandler("TimeBasedRollingTest.test2.1");        rfa1.setFormatter(layout1);        TimeBasedRollingPolicy tbrp1 = new TimeBasedRollingPolicy("output/test2-%d{" + datePattern                + "}");        tbrp1.activateOptions();        rfa1.setRollingPolicy(tbrp1);        rfa1.activateOptions();        this.logger.addHandler(rfa1);        SimpleDateFormat sdf = new SimpleDateFormat(datePattern);        String[] filenames = new String[4];        Calendar cal = Calendar.getInstance();        for (int i = 0; i < 4; i++) {            filenames[i] = "output/test2-" + sdf.format(cal.getTime());            cal.add(Calendar.SECOND, 1);        }        System.out.println("Waiting until next second and 100 millis.");        delayUntilNextSecond(100);        System.out.println("Done waiting.");        for (int i = 0; i <= 2; i++) {            this.logger.finer("Hello---" + i);            Thread.sleep(500);        }        this.logger.removeHandler(rfa1);        rfa1.close();        PatternFormatter layout2 = new PatternFormatter("%c{1} - %m%n");        RollingFileHandler rfa2 = new RollingFileHandler("TimeBasedRollingTest.test2.2");        rfa2.setFormatter(layout2);        TimeBasedRollingPolicy tbrp2 = new TimeBasedRollingPolicy("output/test2-%d{" + datePattern                + "}");        tbrp2.activateOptions();        rfa2.setRollingPolicy(tbrp2);        rfa2.activateOptions();        this.logger.addHandler(rfa2);        for (int i = 3; i <= 4; i++) {            this.logger.finer("Hello---" + i);            Thread.sleep(500);        }        rfa2.close();        for (int i = 0; i < 4; i++) {            assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test2." + i));        }    }