[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.28-37-ge4aa27e

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Tue Mar 29 23:22:58 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  e4aa27eb1dae6b6278ab139444d769edf1280411 (commit)
      from  0bc69a589371a02911e156c0f792231928cb40a8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=e4aa27eb1dae6b6278ab139444d769edf1280411
http://github.com/ceki/logback/commit/e4aa27eb1dae6b6278ab139444d769edf1280411

commit e4aa27eb1dae6b6278ab139444d769edf1280411
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Mar 29 23:00:32 2011 +0200

    refactored millesecond cached formatting code into CachingDateFormatter

diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
index 10de74a..10e7776 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
@@ -13,21 +13,18 @@
  */
 package ch.qos.logback.access.pattern;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
 
 import ch.qos.logback.access.spi.IAccessEvent;
 import ch.qos.logback.core.CoreConstants;
-
+import ch.qos.logback.core.util.CachingDateFormatter;
 
 
 public class DateConverter extends AccessConverter {
 
-  long lastTimestamp = -1;
-  String timesmapStr = null;
-  SimpleDateFormat simpleFormat = null;
+
+  CachingDateFormatter cachingDateFormatter = null;
   
   public void start() {
     
@@ -41,13 +38,13 @@ public class DateConverter extends AccessConverter {
     } 
     
     try {
-      simpleFormat = new SimpleDateFormat(datePattern);
+      cachingDateFormatter = new CachingDateFormatter(datePattern);
       //maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
     } catch (IllegalArgumentException e) {
       addWarn(
         "Could not instantiate SimpleDateFormat with pattern " + datePattern, e);
       // default to the ISO8601 format
-      simpleFormat = new SimpleDateFormat(CoreConstants.CLF_DATE_PATTERN);
+      cachingDateFormatter = new CachingDateFormatter(CoreConstants.CLF_DATE_PATTERN);
     }
     
     List optionList = getOptionList();
@@ -55,23 +52,13 @@ public class DateConverter extends AccessConverter {
     // if the option list contains a TZ option, then set it.
     if (optionList != null && optionList.size() > 1) {
       TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1));
-      simpleFormat.setTimeZone(tz);
+      cachingDateFormatter.setTimeZone(tz);
     }
   }
   
 
   public String convert(IAccessEvent accessEvent) {
-  
     long timestamp = accessEvent.getTimeStamp();
-    
-    // if called multiple times within the same millisecond
-    // return old value
-    if(timestamp == lastTimestamp) {
-      return timesmapStr;
-    } else {
-      lastTimestamp = timestamp;
-      timesmapStr = simpleFormat.format(new Date(timestamp));
-      return timesmapStr;
-    }
+    return cachingDateFormatter.format(timestamp);
   }
 }
diff --git a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
index c71f1e6..19c940a 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
@@ -63,7 +63,7 @@ public class ConverterTest  {
     DateConverter converter = new DateConverter();
     converter.start();
     String result = converter.convert(event);
-    assertEquals(converter.simpleFormat.format(event.getTimeStamp()), result);
+    assertEquals(converter.cachingDateFormatter.format(event.getTimeStamp()), result);
   }
 
   public void testLineLocalPortConverter() {
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 7a32396..8eae411 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -357,6 +357,7 @@
               org.xml.*;resolution:=optional,
               org.slf4j, ch.qos.logback.core.rolling, 
               ch.qos.logback.core.rolling.helper,
+              ch.qos.logback.core.util,
               org.codehaus.groovy.*;resolution:=optional,
               groovy.lang.*;resolution:=optional,
               *
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
index 8193d52..54cc685 100644
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
@@ -30,7 +30,8 @@ import java.text.SimpleDateFormat
 import ch.qos.logback.classic.turbo.TurboFilter
 import ch.qos.logback.core.CoreConstants
 import ch.qos.logback.core.util.ContextUtil
-import ch.qos.logback.core.joran.action.TimestampAction;
+import ch.qos.logback.core.joran.action.TimestampAction
+import ch.qos.logback.core.util.CachingDateFormatter;
 
 /**
  * @author Ceki G&uuml;c&uuml;
@@ -158,17 +159,17 @@ public class ConfigurationDelegate extends ContextAwareBase {
   }
 
   String timestamp(String datePattern, long timeReference = -1) {
-    Date reference = null;
+    long now = -1;
 
     if(timeReference == -1) {
       addInfo("Using current interpretation time, i.e. now, as time reference.");
-      reference = new Date()
+      now = System.currentTimeMillis()
     } else {
-      reference = new Date(timeReference)
-      addInfo("Using " + reference +" as time reference.");
+      now = timeReference
+      addInfo("Using " + now +" as time reference.");
     }
-    SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
-    sdf.format(reference)
+    CachingDateFormatter sdf = new CachingDateFormatter(datePattern);
+    sdf.format(now)
   }
 }
 
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
index 4f0a449..9b9cfaf 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
@@ -20,12 +20,13 @@ import java.util.TimeZone;
 
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.core.CoreConstants;
+import ch.qos.logback.core.util.CachingDateFormatter;
 
 public class DateConverter extends ClassicConverter {
 
   long lastTimestamp = -1;
   String timestampStrCache = null;
-  SimpleDateFormat simpleFormat = null;
+  CachingDateFormatter cachingDateFormatter = null;
 
   public void start() {
 
@@ -40,14 +41,14 @@ public class DateConverter extends ClassicConverter {
     }
 
     try {
-      simpleFormat = new SimpleDateFormat(datePattern);
+      cachingDateFormatter = new CachingDateFormatter(datePattern);
       // maximumCacheValidity =
       // CachedDateFormat.getMaximumCacheValidity(pattern);
     } catch (IllegalArgumentException e) {
       addWarn("Could not instantiate SimpleDateFormat with pattern "
           + datePattern, e);
       // default to the ISO8601 format
-      simpleFormat = new SimpleDateFormat(CoreConstants.ISO8601_PATTERN);
+      cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN);
     }
 
     List optionList = getOptionList();
@@ -55,25 +56,12 @@ public class DateConverter extends ClassicConverter {
     // if the option list contains a TZ option, then set it.
     if (optionList != null && optionList.size() > 1) {
       TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1));
-      simpleFormat.setTimeZone(tz);
+      cachingDateFormatter.setTimeZone(tz);
     }
   }
 
   public String convert(ILoggingEvent le) {
     long timestamp = le.getTimeStamp();
-
-    synchronized (this) {
-      // if called multiple times within the same millisecond
-      // return cache value
-      if (timestamp == lastTimestamp) {
-        return timestampStrCache;
-      } else {
-        lastTimestamp = timestamp;
-        // SimpleDateFormat is not thread safe. 
-        // See also http://jira.qos.ch/browse/LBCLASSIC-36
-        timestampStrCache = simpleFormat.format(new Date(timestamp));
-        return timestampStrCache;
-      }
-    }
+    return cachingDateFormatter.format(timestamp);
   }
 }
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
index 9119aa0..10de840 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
@@ -23,6 +23,7 @@ import ch.qos.logback.classic.jul.JULHelper;
 import ch.qos.logback.core.pattern.parser.Parser;
 import ch.qos.logback.core.pattern.parser.ScanException;
 import ch.qos.logback.core.status.Status;
+import ch.qos.logback.core.util.CachingDateFormatter;
 import ch.qos.logback.core.util.StatusPrinter;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -315,8 +316,8 @@ public class JoranConfiguratorTest {
 
     String r = loggerContext.getProperty("testTimestamp");
     assertNotNull(r);
-    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
-    String expected = sdf.format(new Date());
+    CachingDateFormatter sdf = new CachingDateFormatter("yyyy-MM");
+    String expected = sdf.format(System.currentTimeMillis());
     assertEquals("expected \"" + expected + "\" but got " + r, expected, r);
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
index 18907b6..26cba84 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
@@ -18,6 +18,7 @@ import static org.junit.Assert.assertTrue;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import ch.qos.logback.core.util.CachingDateFormatter;
 import org.junit.Test;
 
 import ch.qos.logback.classic.ClassicTestConstants;
@@ -51,8 +52,8 @@ public class UniqueFileTest {
   @Test
   public void basic() throws Exception {
     loadConfig(ClassicTestConstants.JORAN_INPUT_PREFIX + "unique.xml");
-    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
-    String timestamp = sdf.format(new Date()); 
+    CachingDateFormatter sdf = new CachingDateFormatter("yyyyMMdd'T'HHmmss");
+    String timestamp = sdf.format(System.currentTimeMillis());
     
     StatusChecker sc = new StatusChecker(lc);
     assertTrue(sc.isErrorFree());
diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 03383ed..24671f3 100644
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -85,12 +85,6 @@
           <scope>test</scope>
         </dependency>
 
-        <dependency>
-          <groupId>joda-time</groupId>
-          <artifactId>joda-time</artifactId>
-          <optional>true</optional>
-         </dependency>
-
     </dependencies>
 
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
index d252773..992f4f8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
@@ -16,6 +16,7 @@ package ch.qos.logback.core.joran.action;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import ch.qos.logback.core.util.CachingDateFormatter;
 import org.xml.sax.Attributes;
 
 import ch.qos.logback.core.joran.spi.ActionException;
@@ -53,12 +54,12 @@ public class TimestampAction extends Action {
     }
 
     String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE);
-    Date timeReference = null;
+    long timeReference = -1;
     if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) {
       addInfo("Using context birth as time reference.");
-      timeReference = new Date(context.getBirthTime());
+      timeReference = context.getBirthTime();
     } else {
-      timeReference =  new Date();
+      timeReference =  System.currentTimeMillis();
       addInfo("Using current interpretation time, i.e. now, as time reference.");
     }
 
@@ -66,7 +67,7 @@ public class TimestampAction extends Action {
     if (inError)
       return;
 
-    SimpleDateFormat sdf = new SimpleDateFormat(datePatternStr);
+    CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr);
     String val = sdf.format(timeReference);
 
     addInfo("Adding property to the context with key=\"" + keyStr
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
index 3c7a82d..4ef5e2f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
@@ -18,6 +18,7 @@ import java.util.Date;
 
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.pattern.DynamicConverter;
+import ch.qos.logback.core.util.CachingDateFormatter;
 
 /**
  * Returns a date formatted by SimpleDateFormatter.
@@ -33,7 +34,7 @@ public class DateTokenConverter<E> extends DynamicConverter<E> implements MonoTy
   public static final String DEFAULT_DATE_PATTERN = CoreConstants.DAILY_DATE_PATTERN;
 
   private String datePattern;
-  private SimpleDateFormat sdf;
+  private CachingDateFormatter cdf;
 
   public DateTokenConverter() {
   }
@@ -43,11 +44,11 @@ public class DateTokenConverter<E> extends DynamicConverter<E> implements MonoTy
     if (this.datePattern == null) {
       this.datePattern = DEFAULT_DATE_PATTERN;
     }
-    sdf = new SimpleDateFormat(datePattern);
+    cdf = new CachingDateFormatter(datePattern);
   }
 
   public String convert(Date date) {
-    return sdf.format(date);
+    return cdf.format(date.getTime());
   }
 
   public String convert(Object o) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java b/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java
index fc3f6a0..9009280 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/status/ViewStatusMessagesServletBase.java
@@ -28,11 +28,12 @@ import javax.servlet.http.HttpServletResponse;
 
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.helpers.Transform;
+import ch.qos.logback.core.util.CachingDateFormatter;
 
 abstract public class ViewStatusMessagesServletBase extends HttpServlet {
 
   private static final long serialVersionUID = -3551928133801157219L;
-  private static SimpleDateFormat SDF = new SimpleDateFormat(
+  private static CachingDateFormatter SDF = new CachingDateFormatter(
       "yyyy-MM-dd HH:mm:ss");
 
   static String SUBMIT = "submit";
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/CachingDateFormatter.java b/logback-core/src/main/java/ch/qos/logback/core/util/CachingDateFormatter.java
new file mode 100644
index 0000000..028c596
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/CachingDateFormatter.java
@@ -0,0 +1,45 @@
+package ch.qos.logback.core.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * A synchronized implementation of  SimpleDateFormat which uses caching internally.
+ *
+ * @author Ceki G&uuml;c&uuml;
+ * @since 0.9.29
+ */
+public class CachingDateFormatter {
+
+
+  long lastTimestamp = -1;
+  String cachedStr = null;
+  final SimpleDateFormat sdf;
+
+  public CachingDateFormatter(String pattern) {
+    sdf = new SimpleDateFormat(pattern);
+  }
+
+  public final String format(long now) {
+
+    // SimpleDateFormat is not thread safe.
+
+    // See also the discussion in http://jira.qos.ch/browse/LBCLASSIC-36
+    // DateFormattingThreadedThroughputCalculator and SelectiveDateFormattingRunnable
+    // are also note worthy
+
+    // The now == lastTimestamp guard minimizes synchronization
+    synchronized (this) {
+      if (now != lastTimestamp) {
+        lastTimestamp = now;
+        cachedStr = sdf.format(new Date(now));
+      }
+      return cachedStr;
+    }
+  }
+
+  public void setTimeZone(TimeZone tz) {
+    sdf.setTimeZone(tz);
+  }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/StatusPrinter.java b/logback-core/src/main/java/ch/qos/logback/core/util/StatusPrinter.java
index 79afa8d..ad8a4e2 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/util/StatusPrinter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/StatusPrinter.java
@@ -14,8 +14,6 @@
 package ch.qos.logback.core.util;
 
 import java.io.PrintStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 
@@ -30,7 +28,7 @@ public class StatusPrinter {
 
   private static PrintStream ps = System.out;
 
-  static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
+  static CachingDateFormatter cachingDateFormat = new CachingDateFormatter(
       "HH:mm:ss,SSS");
 
   public static void setPrintStream(PrintStream printStream) {
@@ -151,9 +149,8 @@ public class StatusPrinter {
       prefix = indentation + "|-";
     }
 
-    if (simpleDateFormat != null) {
-      Date date = new Date(s.getDate());
-      String dateStr = simpleDateFormat.format(date);
+    if (cachingDateFormat != null) {
+      String dateStr = cachingDateFormat.format(s.getDate());
       sb.append(dateStr).append(" ");
     }
     sb.append(prefix).append(s).append(CoreConstants.LINE_SEPARATOR);
diff --git a/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java b/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java
deleted file mode 100644
index 94b4399..0000000
--- a/logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package ch.qos.logback.core.time;
-
-import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
-import ch.qos.logback.core.contention.ThreadedThroughputCalculator;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-
-public class DateFormattingThroughputTest {
-
-
-  ThreadedThroughputCalculator t;
-
-  static int THREAD_COUNT = 30;
-  static long OVERALL_DURATION_IN_MILLIS = 2000;
-
-  static String PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
-
-  @Test
-  public void sdf() throws InterruptedException {
-    ThreadedThroughputCalculator tp = new ThreadedThroughputCalculator(
-            OVERALL_DURATION_IN_MILLIS);
-
-    SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);
-    RunnableWithCounterAndDone[] sdfRunnables = buildSDFRunnables(sdf);
-    tp.execute(sdfRunnables);
-    tp.printThroughput("SDF with synchronization:   ", false);
-  }
-
-  RunnableWithCounterAndDone[] buildSDFRunnables(SimpleDateFormat sdf) {
-    RunnableWithCounterAndDone[] runnables = new RunnableWithCounterAndDone[THREAD_COUNT];
-    for (int i = 0; i < THREAD_COUNT; i++) {
-      runnables[i] = new SDFRunnabable(sdf);
-    }
-    return runnables;
-  }
-
-  @Test
-  public void yoda() throws InterruptedException {
-    ThreadedThroughputCalculator tp = new ThreadedThroughputCalculator(
-            OVERALL_DURATION_IN_MILLIS);
-
-    DateTimeFormatter fmt = DateTimeFormat.forPattern(PATTERN);
-    RunnableWithCounterAndDone[] yodaRunnables = buildYodaRunnables(fmt);
-    tp.execute(yodaRunnables);
-    tp.printThroughput("Yoda:   ", false);
-  }
-
-  RunnableWithCounterAndDone[] buildYodaRunnables(DateTimeFormatter fmt) {
-    RunnableWithCounterAndDone[] runnables = new RunnableWithCounterAndDone[THREAD_COUNT];
-    for (int i = 0; i < THREAD_COUNT; i++) {
-      runnables[i] = new YodaTimeRunnable(fmt);
-    }
-    return runnables;
-  }
-
-
-  class SDFRunnabable extends RunnableWithCounterAndDone {
-
-    SimpleDateFormat sdf;
-    long lasttime = -1;
-
-    SDFRunnabable(SimpleDateFormat sdf) {
-      this.sdf = sdf;
-    }
-
-    public void run() {
-      while (!done) {
-        counter++;
-        long now = System.currentTimeMillis();
-        if (now == lasttime) {
-
-        } else {
-          lasttime = now;
-          synchronized (sdf) {
-            sdf.format(new Date());
-          }
-        }
-      }
-    }
-  }
-
-  class YodaTimeRunnable extends RunnableWithCounterAndDone {
-
-    DateTimeFormatter yodaDTFt;
-    long lasttime = -1;
-
-    YodaTimeRunnable(DateTimeFormatter dtf) {
-      this.yodaDTFt = dtf;
-    }
-
-    public void run() {
-      while (!done) {
-        counter++;
-        long now = System.currentTimeMillis();
-        if (now == lasttime) {
-        } else {
-          lasttime = now;
-          yodaDTFt.print(now);
-        }
-      }
-    }
-  }
-
-}
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
index 6b68d2d..905530b 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
@@ -14,15 +14,15 @@
 package ch.qos.logback.core.rolling
 
 import ch.qos.logback.core.{ContextBase, Context}
-import ch.qos.logback.core.util.CoreTestConstants
 import ch.qos.logback.core.testUtil.RandomUtil
 import java.util.{Date, Calendar}
 import java.util.concurrent.TimeUnit
 import java.text.SimpleDateFormat
+import ch.qos.logback.core.util.{CachingDateFormatter, CoreTestConstants}
 
 trait RollingScaffolding {
   final val DATE_PATTERN_WITH_SECONDS = "yyyy-MM-dd_HH_mm_ss"
-  final val SDF = new SimpleDateFormat(DATE_PATTERN_WITH_SECONDS)
+  final val SDF = new CachingDateFormatter(DATE_PATTERN_WITH_SECONDS)
   private[rolling] var context: Context = new ContextBase
   private[rolling] var diff: Int = RandomUtil.getPositiveInt
   protected var currentTime: Long = 0L
@@ -52,7 +52,7 @@ trait RollingScaffolding {
   }
 
   protected def addExpectedFileName_ByDate(outputDir: String, testId: String, date: Date, gzExtension: Boolean): Unit = {
-    var fn: String = outputDir + testId + "-" + SDF.format(date)
+    var fn: String = outputDir + testId + "-" + SDF.format(date.getTime)
     if (gzExtension) {
       fn += ".gz"
     }
diff --git a/pom.xml b/pom.xml
index 6a30698..514ea01 100755
--- a/pom.xml
+++ b/pom.xml
@@ -167,12 +167,6 @@
         <version>${scala.version}</version>
       </dependency>
 
-      <dependency>
-         <groupId>joda-time</groupId>
-         <artifactId>joda-time</artifactId>
-         <version>1.6.2</version>
-      </dependency>
-
     </dependencies>
   </dependencyManagement>
   

-----------------------------------------------------------------------

Summary of changes:
 .../qos/logback/access/pattern/DateConverter.java  |   27 ++----
 .../qos/logback/access/pattern/ConverterTest.java  |    2 +-
 logback-classic/pom.xml                            |    1 +
 .../classic/gaffer/ConfigurationDelegate.groovy    |   15 ++--
 .../qos/logback/classic/pattern/DateConverter.java |   24 +---
 .../classic/joran/JoranConfiguratorTest.java       |    5 +-
 .../logback/classic/rolling/UniqueFileTest.java    |    5 +-
 logback-core/pom.xml                               |    6 -
 .../logback/core/joran/action/TimestampAction.java |    9 +-
 .../core/rolling/helper/DateTokenConverter.java    |    7 +-
 .../core/status/ViewStatusMessagesServletBase.java |    3 +-
 .../logback/core/util/CachingDateFormatter.java    |   45 ++++++++
 .../ch/qos/logback/core/util/StatusPrinter.java    |    9 +-
 .../core/time/DateFormattingThroughputTest.java    |  110 --------------------
 .../logback/core/rolling/RollingScaffolding.scala  |    6 +-
 pom.xml                                            |    6 -
 16 files changed, 91 insertions(+), 189 deletions(-)
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/util/CachingDateFormatter.java
 delete mode 100644 logback-core/src/test/java/ch/qos/logback/core/time/DateFormattingThroughputTest.java


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list