diff options
Diffstat (limited to 'src/net/sourceforge/opentracking')
-rw-r--r-- | src/net/sourceforge/opentracking/Server.java | 14 |
1 files changed, 12 insertions, 2 deletions
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; } }); |