diff src/goodjava/webserver/handlers/LogHandler.java @ 1598:c78d6a4e2d9a

web logging
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 04 Apr 2021 15:09:51 -0600
parents 329197048ff0
children 8a717f0b7f45
line wrap: on
line diff
--- a/src/goodjava/webserver/handlers/LogHandler.java	Fri Mar 26 20:20:21 2021 -0600
+++ b/src/goodjava/webserver/handlers/LogHandler.java	Sun Apr 04 15:09:51 2021 -0600
@@ -21,9 +21,9 @@
 
 
 public final class LogHandler implements Handler {
+	private static final Layout layout = new ListLayout(new DateLayout("yyyy-MM-dd:HH:mm:ss")," ",Layouts.MESSAGE,"\n");
 
 	public static Logger consoleLogger() {
-		Layout layout = new ListLayout(new DateLayout("yyyy-MM-dd:HH:mm:ss")," ",Layouts.MESSAGE,"\n");
 		Appender appender = new ConsoleAppender(layout,System.err);
 		GoodLogger logger = new GoodLogger("HTTP");
 		logger.appender = appender;
@@ -39,8 +39,7 @@
 		} catch(IOException e) {
 			throw new RuntimeException(e);
 		}
-		Layout layout = new ListLayout(new DateLayout("yyyy-MM-dd:HH:mm:ss")," ",Layouts.MESSAGE,"\n");
-		DateFormat fmt = new SimpleDateFormat( "'" + dir + "/'yyyy_MM_dd_HH_mm'.log'" );
+		DateFormat fmt = new SimpleDateFormat( "'" + dir + "/'yyyy_MM_dd'.log'" );
 		Appender appender = new DailyRollingFileAppender(layout,fmt);
 		GoodLogger logger = new GoodLogger("HTTP");
 		logger.appender = appender;