@Test public void testInnerFile() throws IOException { String file = loggingDir + "/logger.log"; Logger fileLogger = Logger.getLogger("fileLogger"); Appender myappender = LoggingBuilder.newAppenderBuilder() .withDailyFileRollingAppender(file, "'.'yyyy-MM-dd") .withName("myappender") .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build(); fileLogger.addAppender(myappender); Logger.getLogger("fileLogger").setLevel(Level.INFO); Logger.getLogger("fileLogger").info("fileLogger info Message"); Logger.getLogger("fileLogger").error("fileLogger error Message", new RuntimeException()); Logger.getLogger("fileLogger").debug("fileLogger debug message"); myappender.close(); String content = readFile(file); System.out.println(content); Assert.assertTrue(content.contains("info")); Assert.assertTrue(content.contains("RuntimeException")); Assert.assertTrue(!content.contains("debug")); }
public abstract void close();
Appender { public abstract void close(); }
Appender { public abstract void close();  }
Appender { public abstract void close();  void activateOptions(); void finalize(); Layout getLayout(); final String getName(); synchronized void doAppend(LoggingEvent event); void setLayout(Layout layout); void setName(String name); abstract void close(); void handleError(String message, Exception e, int errorCode); void handleError(String message); }
Appender { public abstract void close();  void activateOptions(); void finalize(); Layout getLayout(); final String getName(); synchronized void doAppend(LoggingEvent event); void setLayout(Layout layout); void setName(String name); abstract void close(); void handleError(String message, Exception e, int errorCode); void handleError(String message); static final int CODE_WRITE_FAILURE; static final int CODE_FLUSH_FAILURE; static final int CODE_CLOSE_FAILURE; static final int CODE_FILE_OPEN_FAILURE; final static String LINE_SEP; }