[logback-dev] svn commit: r2085 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic/hoard main/java/ch/qos/logback/classic/joran main/java/ch/qos/logback/classic/sift test/java/ch/qos/logback/classic test/java/ch/qos/logback/classic/hoard test/java/ch/qos/logback/classic/hoard/tracker test/java/ch/qos/logback/classic/sift

noreply.ceki at qos.ch noreply.ceki at qos.ch
Thu Dec 18 21:15:43 CET 2008


Author: ceki
Date: Thu Dec 18 21:15:43 2008
New Revision: 2085

Added:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/
      - copied from r2079, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderFactory.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTracker.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTracker.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTrackerImpl.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTrackerImpl.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardAction.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingAppender.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingAppender.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingJoranConfigurator.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/AppenderTrackerTest.java
      - copied, changed from r2084, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/AppenderTrackerTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java
      - copied, changed from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/PackageTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/ScenarioBasedAppenderTrackerTest.java
      - copied, changed from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/ScenarioBasedAppenderTrackerTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/Simulator.java
      - copied, changed from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/Simulator.java
Removed:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/AppenderTrackerTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/HoardingAppenderTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/PackageTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/ScenarioBasedAppenderTrackerTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/Simulator.java
Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/tracker/AppenderTrackerTImpl.java

Log:
Renamed HoardingAppender as SiftingAppender

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java	Thu Dec 18 21:15:43 2008
@@ -10,7 +10,6 @@
 
 package ch.qos.logback.classic.joran;
 
-import ch.qos.logback.classic.hoard.HoardAction;
 import ch.qos.logback.classic.joran.action.ConfigurationAction;
 import ch.qos.logback.classic.joran.action.ConsolePluginAction;
 import ch.qos.logback.classic.joran.action.ContextNameAction;
@@ -21,6 +20,7 @@
 import ch.qos.logback.classic.joran.action.LevelAction;
 import ch.qos.logback.classic.joran.action.LoggerAction;
 import ch.qos.logback.classic.joran.action.RootLoggerAction;
+import ch.qos.logback.classic.sift.HoardAction;
 import ch.qos.logback.classic.spi.PlatformInfo;
 import ch.qos.logback.core.joran.JoranConfiguratorBase;
 import ch.qos.logback.core.joran.action.AppenderRefAction;

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderFactory.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderFactory.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java	Thu Dec 18 21:15:43 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTracker.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTracker.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTracker.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTracker.java	Thu Dec 18 21:15:43 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.List;
 

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTrackerImpl.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTrackerImpl.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/AppenderTrackerImpl.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderTrackerImpl.java	Thu Dec 18 21:15:43 2008
@@ -7,7 +7,7 @@
  * the terms of the GNU Lesser General Public License as published by the Free
  * Software Foundation.
  */
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.HashMap;
 import java.util.LinkedList;

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardAction.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java	Thu Dec 18 21:15:43 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingAppender.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingAppender.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingAppender.java	Thu Dec 18 21:15:43 2008
@@ -7,7 +7,7 @@
  * the terms of the GNU Lesser General Public License as published by the Free
  * Software Foundation.
  */
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import org.slf4j.MDC;
 

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java (from r2084, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingJoranConfigurator.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/hoard/HoardingJoranConfigurator.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java	Thu Dec 18 21:15:43 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.Collection;
 import java.util.HashMap;

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java	Thu Dec 18 21:15:43 2008
@@ -35,7 +35,7 @@
     suite.addTest(ch.qos.logback.classic.spi.PackageTest.suite());
     suite.addTest(new JUnit4TestAdapter(ch.qos.logback.classic.turbo.PackageTest.class));
     suite.addTest(new JUnit4TestAdapter(
-        ch.qos.logback.classic.hoard.PackageTest.class));
+        ch.qos.logback.classic.sift.PackageTest.class));
 
     return suite;
   }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/tracker/AppenderTrackerTImpl.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/tracker/AppenderTrackerTImpl.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/tracker/AppenderTrackerTImpl.java	Thu Dec 18 21:15:43 2008
@@ -14,7 +14,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import ch.qos.logback.classic.hoard.AppenderTracker;
+import ch.qos.logback.classic.sift.AppenderTracker;
 import ch.qos.logback.core.Appender;
 
 /**

Copied: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/AppenderTrackerTest.java (from r2084, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/AppenderTrackerTest.java)
==============================================================================
--- /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/AppenderTrackerTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/AppenderTrackerTest.java	Thu Dec 18 21:15:43 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -8,6 +8,8 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import ch.qos.logback.classic.sift.AppenderTracker;
+import ch.qos.logback.classic.sift.AppenderTrackerImpl;
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;
 import ch.qos.logback.core.read.ListAppender;

Copied: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java (from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/PackageTest.java)
==============================================================================
--- /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/PackageTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java	Thu Dec 18 21:15:43 2008
@@ -7,13 +7,13 @@
  * the terms of the GNU Lesser General Public License as published by the Free
  * Software Foundation.
  */
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
- at SuiteClasses({HoardingAppenderTest.class})
+ at SuiteClasses({SiftingAppenderTest.class})
 public class PackageTest  {
 }
\ No newline at end of file

Copied: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/ScenarioBasedAppenderTrackerTest.java (from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/ScenarioBasedAppenderTrackerTest.java)
==============================================================================
--- /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/ScenarioBasedAppenderTrackerTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/ScenarioBasedAppenderTrackerTest.java	Thu Dec 18 21:15:43 2008
@@ -7,13 +7,15 @@
  * the terms of the GNU Lesser General Public License as published by the Free
  * Software Foundation.
  */
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Ignore;
 import org.junit.Test;
 
+import ch.qos.logback.classic.sift.AppenderTracker;
+
 public class ScenarioBasedAppenderTrackerTest {
 
   Simulator simulator;

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java	Thu Dec 18 21:15:43 2008
@@ -0,0 +1,96 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ * 
+ * Copyright (C) 2000-2008, QOS.ch
+ * 
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
+package ch.qos.logback.classic.sift;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.slf4j.MDC;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.classic.sift.AppenderTracker;
+import ch.qos.logback.classic.sift.HoardingAppender;
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.classic.util.TeztConstants;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.read.ListAppender;
+import ch.qos.logback.core.util.StatusPrinter;
+
+public class SiftingAppenderTest {
+
+  static String PREFIX = TeztConstants.TEST_DIR_PREFIX + "input/joran/hoard/";
+  		
+  LoggerContext loggerContext = new LoggerContext();
+  Logger logger = loggerContext.getLogger(this.getClass().getName());
+  Logger root = loggerContext.getLogger(LoggerContext.ROOT_NAME);
+
+  void configure(String file) throws JoranException {
+    JoranConfigurator jc = new JoranConfigurator();
+    jc.setContext(loggerContext);
+    jc.doConfigure(file);
+  }
+
+  @Test
+  public void unsetDefaultValueProperty() throws JoranException {
+    configure(PREFIX + "unsetDefaultValueProperty.xml");
+    logger.debug("hello");
+    HoardingAppender ha = (HoardingAppender) root.getAppender("HOARD");
+    assertFalse(ha.isStarted());
+    
+  }
+
+  @Test
+  public void smoke() throws JoranException {
+    configure(PREFIX + "smoke.xml");
+    logger.debug("smoke");
+    long timestamp = 0;
+    HoardingAppender ha = (HoardingAppender) root.getAppender("HOARD");
+    ListAppender<LoggingEvent> listAppender = (ListAppender<LoggingEvent>) ha.appenderTracker.get("smoke", timestamp);
+    
+    StatusPrinter.print(loggerContext);
+    assertNotNull(listAppender);
+    List<LoggingEvent> eventList = listAppender.list;
+    assertEquals(1, listAppender.list.size());
+    assertEquals("smoke", eventList.get(0).getMessage());
+  }
+
+  @Test
+  public void testWholeCycle() throws JoranException {
+    String mdcKey = "cycle";
+    configure(PREFIX + "completeCycle.xml");
+    MDC.put(mdcKey, "a");
+    logger.debug("smoke");
+    long timestamp = System.currentTimeMillis();
+    HoardingAppender ha = (HoardingAppender) root.getAppender("HOARD");
+    ListAppender<LoggingEvent> listAppender = (ListAppender<LoggingEvent>) ha.appenderTracker.get("a", timestamp);
+    StatusPrinter.print(loggerContext);
+    
+    assertNotNull(listAppender);
+    List<LoggingEvent> eventList = listAppender.list;
+    assertEquals(1, listAppender.list.size());
+    assertEquals("smoke", eventList.get(0).getMessage());
+
+    MDC.remove(mdcKey);
+    LoggingEvent le = new LoggingEvent("x", logger, Level.INFO, "hello", null, null);
+    le.setTimeStamp(timestamp+AppenderTracker.THRESHOLD*2);
+    ha.doAppend(le);
+    assertFalse(listAppender.isStarted());
+    assertEquals(1, ha.appenderTracker.keyList().size());
+    assertEquals("cycleDefault", ha.appenderTracker.keyList().get(0));
+    
+  }
+}

Copied: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/Simulator.java (from r2082, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/Simulator.java)
==============================================================================
--- /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/hoard/Simulator.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/sift/Simulator.java	Thu Dec 18 21:15:43 2008
@@ -7,7 +7,7 @@
  * the terms of the GNU Lesser General Public License as published by the Free
  * Software Foundation.
  */
-package ch.qos.logback.classic.hoard;
+package ch.qos.logback.classic.sift;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -17,6 +17,8 @@
 
 import ch.qos.logback.classic.hoard.tracker.SimulationEvent;
 import ch.qos.logback.classic.hoard.tracker.AppenderTrackerTImpl;
+import ch.qos.logback.classic.sift.AppenderTracker;
+import ch.qos.logback.classic.sift.AppenderTrackerImpl;
 import ch.qos.logback.core.Appender;
 import ch.qos.logback.core.appender.NOPAppender;
 


More information about the logback-dev mailing list