You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by al...@locus.apache.org on 2000/07/05 22:01:00 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/logging TomcatLogger.java
alex 00/07/05 13:00:53
Modified: src/share/org/apache/tomcat/logging TomcatLogger.java
Log:
use new Logger.formatTimestamp method to format the timestamp
use correct platform-dependent line-ending character in log files
(uses "line.separator" system property)
Revision Changes Path
1.8 +15 -7 jakarta-tomcat/src/share/org/apache/tomcat/logging/TomcatLogger.java
Index: TomcatLogger.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/logging/TomcatLogger.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TomcatLogger.java 2000/06/22 23:10:25 1.7
+++ TomcatLogger.java 2000/07/05 20:00:47 1.8
@@ -115,7 +115,7 @@
LogEntry(String message, Throwable t) {
// avoid expensive system call
- if (TomcatLogger.this.timeStamp)
+ if (TomcatLogger.this.timestamp)
this.date = System.currentTimeMillis();
this.message = message;
this.t = t;
@@ -145,16 +145,17 @@
val.append("> ");
}
- if (TomcatLogger.this.timeStamp) {
- val.append(new Date(date).toString());
- val.append(" ");
+ if (TomcatLogger.this.timestamp) {
+ formatTimestamp( date, val );
+ val.append(" - ");
}
- if (message != null)
+ if (message != null) {
val.append(message);
-
+ }
+
if (t != null) {
- val.append(" ");
+ val.append(" - ");
val.append(throwableToString( t ));
}
@@ -224,6 +225,12 @@
setDaemon(true);
}
+ static char[] newline;
+ static {
+ String separator = System.getProperty("line.separator", "\n");
+ newline = separator.toCharArray();
+ }
+
Runnable flusher = new Runnable() {
public void run() {
do {
@@ -233,6 +240,7 @@
if (writer != null)
try {
writer.write(logEntry.toString());
+ writer.write(newline);
writer.flush();
} catch (Exception ex) { // IOException
ex.printStackTrace();