From e71d3a6b1ee198a3c0c99b354e111663dedf84e7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 16 Jun 2011 08:18:30 +0000 Subject: --- src/net/sourceforge/opentracking/Server.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/net/sourceforge') diff --git a/src/net/sourceforge/opentracking/Server.java b/src/net/sourceforge/opentracking/Server.java index 18194b3e6..b34e4cf46 100644 --- a/src/net/sourceforge/opentracking/Server.java +++ b/src/net/sourceforge/opentracking/Server.java @@ -26,6 +26,9 @@ import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.logging.Logger; import java.util.logging.FileHandler; import java.util.logging.Formatter; @@ -181,7 +184,7 @@ public class Server implements DataManager { insertPosition.executeUpdate(); } - + /** * Init logger */ @@ -200,9 +203,16 @@ public class Server implements DataManager { file.setFormatter(new Formatter() { private final String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); + + private final DateFormat dateFormat = + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); public String format(LogRecord record) { - return record.getMessage().concat(LINE_SEPARATOR); + String line = dateFormat.format(new Date(record.getMillis())); + line += " - "; + line += formatMessage(record); + line += LINE_SEPARATOR; + return line; } }); -- cgit v1.2.3