aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 22:02:11 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 22:02:11 +1300
commita59ca5006a4d3547fbbb2931ad8a163f332ad65b (patch)
treef420098b3063a4a8b7538e9cb7fd2e51dfbb74d6
parent8d49ced822a1ae5c8b3f065178116e95a4f55c85 (diff)
downloadtrackermap-server-a59ca5006a4d3547fbbb2931ad8a163f332ad65b.tar.gz
trackermap-server-a59ca5006a4d3547fbbb2931ad8a163f332ad65b.tar.bz2
trackermap-server-a59ca5006a4d3547fbbb2931ad8a163f332ad65b.zip
Improve logging
-rw-r--r--src/org/traccar/Server.java18
1 files 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();
}
});