Mercurial Hosting > luan
diff src/goodjava/webserver/handlers/LogHandler.java @ 1600:8a717f0b7f45
add DailyRollingFileAppender.deleteAfter
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 09 Apr 2021 19:44:14 -0600 |
parents | c78d6a4e2d9a |
children | 94ea190714dd |
line wrap: on
line diff
--- a/src/goodjava/webserver/handlers/LogHandler.java Mon Apr 05 00:13:05 2021 -0600 +++ b/src/goodjava/webserver/handlers/LogHandler.java Fri Apr 09 19:44:14 2021 -0600 @@ -31,7 +31,7 @@ return logger; } - public static Logger dirLogger(File dir) { + public static Logger dirLogger(File dir,long deleteAfter) { if( dir.exists() && !dir.isDirectory() ) throw new RuntimeException("must be a directory"); try { @@ -40,7 +40,8 @@ throw new RuntimeException(e); } DateFormat fmt = new SimpleDateFormat( "'" + dir + "/'yyyy_MM_dd'.log'" ); - Appender appender = new DailyRollingFileAppender(layout,fmt); + DailyRollingFileAppender appender = new DailyRollingFileAppender(layout,fmt); + appender.deleteAfter = deleteAfter; GoodLogger logger = new GoodLogger("HTTP"); logger.appender = appender; logger.level = Level.INFO;