Author: kfujino Date: Tue Sep 3 09:49:03 2013 New Revision: 1519622 URL: http://svn.apache.org/r1519622 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/tc7.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java?rev=1519622&r1=1519621&r2=1519622&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java Tue Sep 3 09:49:03 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,7 +86,8 @@ 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(); } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1519622&r1=1519621&r2=1519622&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Sep 3 09:49:03 2013 @@ -150,6 +150,10 @@ automatically re-tries the action that failed. Make clear in the log message that the action is being re-tried. (markt) </fix> + <fix> + Correct several incorrect formats of <code>JdkLoggerFormatter</code>. + (kfujino) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org