[logback-dev] svn commit: r724 - in logback/trunk: logback-access/src/main/java/ch/qos/logback/access/pattern logback-classic/src/main/java/ch/qos/logback/classic/pattern logback-core/src/main/java/ch/qos/logback/core

noreply.seb at qos.ch noreply.seb at qos.ch
Fri Oct 20 14:55:02 CEST 2006


Author: seb
Date: Fri Oct 20 14:55:02 2006
New Revision: 724

Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreGlobal.java

Log:
Added support for DATE, ABSOLUTE and ISO8601 patterns in DateConverter.
Updated classic and access module' implementations of DateConverter.java


Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java	Fri Oct 20 14:55:02 2006
@@ -32,6 +32,13 @@
       datePattern = CoreGlobal.CLF_DATE_PATTERN;
     }
     
+    if (datePattern.equals(CoreGlobal.ISO8601_FORMAT)) {
+      datePattern = CoreGlobal.ISO8601_PATTERN;
+    } else if (datePattern.equals(CoreGlobal.DATE_AND_TIME_FORMAT)) {
+      datePattern = CoreGlobal.DATE_AND_TIME_PATTERN;
+    } else if (datePattern.equals(CoreGlobal.ABSOLUTE_FORMAT)) {
+      datePattern = CoreGlobal.ABSOLUTE_PATTERN;
+    }
     
     try {
       simpleFormat = new SimpleDateFormat(datePattern);

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java	Fri Oct 20 14:55:02 2006
@@ -19,7 +19,7 @@
 
 
 public class DateConverter extends ClassicConverter {
-
+  
   long lastTimestamp = -1;
   String timesmapStr = null;
   SimpleDateFormat simpleFormat = null;
@@ -31,6 +31,13 @@
       datePattern = CoreGlobal.ISO8601_PATTERN;
     }
     
+    if (datePattern.equals(CoreGlobal.ISO8601_FORMAT)) {
+      datePattern = CoreGlobal.ISO8601_PATTERN;
+    } else if (datePattern.equals(CoreGlobal.DATE_AND_TIME_FORMAT)) {
+      datePattern = CoreGlobal.DATE_AND_TIME_PATTERN;
+    } else if (datePattern.equals(CoreGlobal.ABSOLUTE_FORMAT)) {
+      datePattern = CoreGlobal.ABSOLUTE_PATTERN;
+    }
     
     try {
       simpleFormat = new SimpleDateFormat(datePattern);

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreGlobal.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreGlobal.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreGlobal.java	Fri Oct 20 14:55:02 2006
@@ -15,7 +15,15 @@
    * {@link Context} object store.
    */
   public static final String PATTERN_RULE_REGISTRY = "PATTERN_RULE_REGISTRY";
-  public static  final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
+  
+  public static final String ABSOLUTE_FORMAT = "ABSOLUTE";
+  public static final String ABSOLUTE_PATTERN = "HH:mm:ss,SSS";
+
+  public static final String DATE_AND_TIME_FORMAT = "DATE";
+  public static final String DATE_AND_TIME_PATTERN = "dd MMM yyyy HH:mm:ss,SSS";
+  
+  public static final String ISO8601_FORMAT = "ISO8601";
+  public static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
  
   /**
    * Time format used in Common Log Format



More information about the logback-dev mailing list