Author: markt
Date: Mon Jun 20 18:19:08 2011
New Revision: 1137731

URL: http://svn.apache.org/viewvc?rev=1137731&view=rev
Log:
Address kkolinko's review comments

Modified:
    tomcat/trunk/java/org/apache/juli/OneLineFormatter.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/juli/OneLineFormatter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/OneLineFormatter.java?rev=1137731&r1=1137730&r2=1137731&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/OneLineFormatter.java (original)
+++ tomcat/trunk/java/org/apache/juli/OneLineFormatter.java Mon Jun 20 18:19:08 
2011
@@ -47,10 +47,10 @@ public class OneLineFormatter extends Fo
     private final SimpleDateFormat monthFormatter = new SimpleDateFormat("MM");
     private final SimpleDateFormat yearFormatter = new 
SimpleDateFormat("yyyy");
     private final SimpleDateFormat timeFormatter =
-        new SimpleDateFormat("HH:mm:ss.S");
+        new SimpleDateFormat("HH:mm:ss.SSS");
     
-    private Date currentDate;
-    private String currentDateString;
+    private volatile Date currentDate;
+    private volatile String currentDateString;
 
     @Override
     public String format(LogRecord record) {
@@ -71,7 +71,7 @@ public class OneLineFormatter extends Fo
         
         // Message
         sb.append(' ');
-        sb.append(record.getMessage());
+        sb.append(formatMessage(record));
         
         // Stack trace
         if (record.getThrown() != null) {
@@ -89,10 +89,10 @@ public class OneLineFormatter extends Fo
         return sb.toString();
     }
 
-    public void addTimestamp(StringBuilder buf, Date date) {
-        if (currentDate != date) {
+    protected void addTimestamp(StringBuilder buf, Date date) {
+        if (currentDate.getTime() != date.getTime()) {
             synchronized (this) {
-                if (currentDate != date) {
+                if (currentDate.getTime() != date.getTime()) {
                     StringBuilder current = new StringBuilder(32);
                     current.append(dayFormatter.format(date)); // Day
                     current.append('-');

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1137731&r1=1137730&r2=1137731&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 20 18:19:08 2011
@@ -78,6 +78,13 @@
         when Tomcat was shutdown. This fix ensures that that work directory for
         an application is not deleted when Tomcat is shutdown. (mark)
       </fix>
+      <fix>
+        Correct issues with JULI&apos;s OneLineFormatter including: correctly
+        re-using formatted timestamps when possible; thread-safety issues in
+        tiomstamp formatting; correcting the output of any milliseconds to
+        include leading zeros and formatting any parameters present.
+        (kolinko/markt)
+      </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

Reply via email to