tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1519618 - /tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java
Date Tue, 03 Sep 2013 09:42:12 GMT
Author: kfujino
Date: Tue Sep  3 09:42:12 2013
New Revision: 1519618

URL: http://svn.apache.org/r1519618
Log:
Correct several incorrect formats of JdkLoggerFormatter.
-Remove duplicate spaces in front of log level.
-Add a space between logger name and message.
-use system property.

Modified:
    tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java

Modified: tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java?rev=1519618&r1=1519617&r2=1519618&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java (original)
+++ tomcat/trunk/java/org/apache/juli/JdkLoggerFormatter.java Tue Sep  3 09:42:12 2013
@@ -41,6 +41,9 @@ import java.util.logging.LogRecord;
  * @author Costin Manolache
  */
 public class JdkLoggerFormatter extends Formatter {
+
+    private static final String LINE_SEP = System.getProperty("line.separator");
+
     // values from JDK Level
     public static final int LOG_LEVEL_TRACE  = 400;
     public static final int LOG_LEVEL_DEBUG  = 500;
@@ -65,7 +68,6 @@ public class JdkLoggerFormatter extends 
         StringBuilder buf = new StringBuilder();
 
         buf.append(time);
-        buf.append(" ");
 
         // pad to 8 to make it more readable
         for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
@@ -84,6 +86,7 @@ public class JdkLoggerFormatter extends 
 
         // Append the name of the log instance if so configured
         buf.append(name);
+        buf.append(" ");
 
         // pad to 20 chars
         for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
@@ -93,7 +96,7 @@ public class JdkLoggerFormatter extends 
 
         // Append stack trace if not null
         if(t != null) {
-            buf.append(" \n");
+            buf.append(LINE_SEP);
 
             java.io.StringWriter sw= new java.io.StringWriter(1024);
             java.io.PrintWriter pw= new java.io.PrintWriter(sw);
@@ -102,7 +105,7 @@ public class JdkLoggerFormatter extends 
             buf.append(sw.toString());
         }
 
-        buf.append("\n");
+        buf.append(LINE_SEP);
         // Print to the appropriate destination
         return buf.toString();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message