From a59ca5006a4d3547fbbb2931ad8a163f332ad65b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 4 Dec 2012 22:02:11 +1300 Subject: Improve logging --- src/org/traccar/Server.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index b80d22c8f..f5a67cc68 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.nio.ByteOrder; import java.sql.SQLException; import java.text.DateFormat; +import java.text.FieldPosition; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; @@ -179,11 +180,18 @@ public class Server { new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); public String format(LogRecord record) { - String line = dateFormat.format(new Date(record.getMillis())); - line += " " + record.getLevel().getName() + ": "; - line += formatMessage(record); - line += LINE_SEPARATOR; - return line; + StringBuffer line = new StringBuffer(); + dateFormat.format(new Date(record.getMillis()), line, new FieldPosition(0)); + line.append(" "); + line.append(record.getSourceClassName()); + line.append("."); + line.append(record.getSourceMethodName()); + line.append(" "); + line.append(record.getLevel().getName()); + line.append(": "); + line.append(formatMessage(record)); + line.append(LINE_SEPARATOR); + return line.toString(); } }); -- cgit v1.2.3