logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1188557 [1/2] - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: log4j2-core/src/main/java/org/apache/logging/log4j/core/ log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ log4j2-core/src/main/java/org/apache/logg...
Date Tue, 25 Oct 2011 07:41:13 GMT
Author: rgoers
Date: Tue Oct 25 07:41:10 2011
New Revision: 1188557

URL: http://svn.apache.org/viewvc?rev=1188557&view=rev
Log:
Use CompositeFilter for multiple Filters

Added:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/CompositeFilter.java
      - copied, changed from r1147720, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filters.java
Removed:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filters.java
Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Appender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/Routes.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filterable.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filtering.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThresholdFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/resources/Log4J-V2.0.xsd
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/InMemoryAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/ListAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/BurstFilterTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/FlumeFuncTest.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-burst.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-rolling1.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-rolling2.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-rolling3.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-routing.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-strict1.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test1.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/src/test/resources/log4j-test1.xml
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/resources/log4j-test1.xml

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Appender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Appender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Appender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Appender.java Tue Oct 25 07:41:10 2011
@@ -66,6 +66,12 @@ public interface Appender extends Lifecy
     boolean requiresLayout();
 
     /**
+     * Returns a Filter if one is present.
+     * @return the Filter or null if no Filter is associated with the Appender.
+     */
+    Filter getFilter();
+
+    /**
      * If set to true any exceptions thrown by the Appender will be logged but not thrown.
      * @return true if Exceptions should be suppressed, false otherwise.
      */

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java Tue Oct 25 07:41:10 2011
@@ -20,10 +20,13 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.core.filter.CompositeFilter;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.spi.AbstractLogger;
 
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -178,7 +181,16 @@ public class Logger extends AbstractLogg
      * @return An Iterator over all the Filters associated with the Logger.
      */
     public Iterator<Filter> getFilters() {
-        return config.loggerConfig.getFilters();
+        Filter filter = config.loggerConfig.getFilter();
+        if (filter == null) {
+            return new ArrayList<Filter>().iterator();
+        } else if (filter instanceof CompositeFilter) {
+            return ((CompositeFilter) filter).iterator();
+        } else {
+            List<Filter> filters = new ArrayList<Filter>();
+            filters.add(filter);
+            return filters.iterator();
+        }
     }
 
     /**
@@ -186,7 +198,13 @@ public class Logger extends AbstractLogg
      * @return The number of Filters associated with the Logger.
      */
     public int filterCount() {
-        return config.loggerConfig.filterCount();
+        Filter filter = config.loggerConfig.getFilter();
+        if (filter == null) {
+            return 0;
+        } else if (filter instanceof CompositeFilter) {
+            return ((CompositeFilter) filter).size();
+        }
+        return 1;
     }
 
     /**
@@ -270,14 +288,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, String msg) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -285,14 +300,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, String msg, Throwable t) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, t);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, t);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -300,14 +312,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, String msg, Object p1) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, p1);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, p1);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -315,14 +324,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, String msg, Object p1, Object p2) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -330,14 +336,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, String msg, Object p1, Object p2, Object p3) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2, p3);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2, p3);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -346,14 +349,11 @@ public class Logger extends AbstractLogg
 
         boolean filter(Level level, Marker marker, String msg, Object p1, Object p2, Object p3,
                        Object... params) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2, p3, params);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, p1, p2, p3, params);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -361,14 +361,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, Object msg, Throwable t) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, t);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, t);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 
@@ -376,14 +373,11 @@ public class Logger extends AbstractLogg
         }
 
         boolean filter(Level level, Marker marker, Message msg, Throwable t) {
-            if (config.hasFilters()) {
-                Iterator<Filter> iter = config.getFilters();
-                while (iter.hasNext()) {
-                    Filter filter = iter.next();
-                    Filter.Result r = filter.filter(logger, level, marker, msg, t);
-                    if (r != Filter.Result.NEUTRAL) {
-                        return r == Filter.Result.ACCEPT;
-                    }
+            Filter filter = config.getFilter();
+            if (filter != null) {
+                Filter.Result r = filter.filter(logger, level, marker, msg, t);
+                if (r != Filter.Result.NEUTRAL) {
+                    return r == Filter.Result.ACCEPT;
                 }
             }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java Tue Oct 25 07:41:10 2011
@@ -18,11 +18,11 @@ package org.apache.logging.log4j.core.ap
 
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.ErrorHandler;
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Lifecycle;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.filter.Filterable;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.Logger;
 
@@ -52,15 +52,15 @@ public abstract class AppenderBase exten
 
     public static final String NAME = "name";
 
-    public AppenderBase(String name, Filters filters, Layout layout) {
-        this(name, filters, layout, true);
+    public AppenderBase(String name, Filter filter, Layout layout) {
+        this(name, filter, layout, true);
     }
 
-    public AppenderBase(String name, Filters filters, Layout layout, boolean handleException) {
+    public AppenderBase(String name, Filter filter, Layout layout, boolean handleException) {
+        super(filter);
         this.name = name;
         this.layout = layout;
         this.handleException = handleException;
-        setFilters(filters);
     }
 
     public ErrorHandler getHandler() {
@@ -114,13 +114,13 @@ public abstract class AppenderBase exten
             logger.error("A layout is required and none was provided");
             return;
         }
-        startFilters();
+        startFilter();
         this.started = true;
     }
 
     public void stop() {
         this.started = false;
-        stopFilters();
+        stopFilter();
     }
 
     public boolean isStarted() {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java Tue Oct 25 07:41:10 2011
@@ -16,12 +16,12 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 
 import java.io.OutputStream;
 
@@ -56,14 +56,14 @@ public class ConsoleAppender extends Out
         this(name, layout, null, getManager(Target.SYSTEM_OUT), handleExceptions);
     }
 
-    public ConsoleAppender(String name, Layout layout, Filters filters, OutputStreamManager manager,
+    public ConsoleAppender(String name, Layout layout, Filter filter, OutputStreamManager manager,
                            boolean handleExceptions) {
-        super(name, layout, filters, handleExceptions, true, manager);
+        super(name, layout, filter, handleExceptions, true, manager);
     }
 
     @PluginFactory
     public static ConsoleAppender createAppender(@PluginElement("layout") Layout layout,
-                                                 @PluginElement("filters") Filters filters,
+                                                 @PluginElement("filters") Filter filter,
                                                  @PluginAttr("target") String t,
                                                  @PluginAttr("name") String name,
                                                  @PluginAttr("suppressExceptions") String suppress) {
@@ -73,7 +73,7 @@ public class ConsoleAppender extends Out
         }
         boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
         Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
-        return new ConsoleAppender(name, layout, filters, getManager(target), handleExceptions);
+        return new ConsoleAppender(name, layout, filter, getManager(target), handleExceptions);
     }
 
     private static OutputStreamManager getManager(Target target) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java Tue Oct 25 07:41:10 2011
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.core.ap
 
 import org.apache.logging.log4j.LoggingException;
 import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.AppenderControl;
 import org.apache.logging.log4j.core.config.Configuration;
@@ -26,7 +27,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -51,9 +51,9 @@ public class FailoverAppender extends Ap
     private List<AppenderControl> failoverAppenders = new ArrayList<AppenderControl>();
 
 
-    public FailoverAppender(String name, Filters filters, String primary, String[] failovers,
+    public FailoverAppender(String name, Filter filter, String primary, String[] failovers,
                             Configuration config, boolean handleExceptions) {
-        super(name, filters, null, handleExceptions);
+        super(name, filter, null, handleExceptions);
         this.primaryRef = primary;
         this.failovers = failovers;
         this.config = config;
@@ -138,7 +138,7 @@ public class FailoverAppender extends Ap
                                                   @PluginAttr("primary") String primary,
                                                   @PluginElement("failovers") String[] failovers,
                                                   @PluginConfiguration Configuration config,
-                                                  @PluginElement("filters") Filters filters,
+                                                  @PluginElement("filters") Filter filter,
                                                   @PluginAttr("suppressExceptions") String suppress) {
         if (name == null) {
             logger.error("A name for the Appender must be specified");
@@ -155,6 +155,6 @@ public class FailoverAppender extends Ap
 
         boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
 
-        return new FailoverAppender(name, filters, primary, failovers, config, handleExceptions);
+        return new FailoverAppender(name, filter, primary, failovers, config, handleExceptions);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java Tue Oct 25 07:41:10 2011
@@ -22,11 +22,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
-
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
 
 /**
  *
@@ -36,9 +31,9 @@ public class FileAppender extends Output
 
     public final String fileName;
 
-    public FileAppender(String name, Layout layout, Filters filters, FileManager manager, String filename,
+    public FileAppender(String name, Layout layout, Filter filter, FileManager manager, String filename,
                         boolean handleException, boolean immediateFlush) {
-        super(name, layout, filters, handleException, immediateFlush, manager);
+        super(name, layout, filter, handleException, immediateFlush, manager);
         this.fileName = filename;
     }
 
@@ -51,7 +46,7 @@ public class FileAppender extends Output
                                               @PluginAttr("suppressExceptions") String suppress,
                                               @PluginAttr("bufferedIO") String bufferedIO,
                                               @PluginElement("layout") Layout layout,
-                                              @PluginElement("filters") Filters filters) {
+                                              @PluginElement("filters") Filter filter) {
 
         boolean isAppend = append == null ? true : Boolean.valueOf(append);
         boolean isLocking = locking == null ? false : Boolean.valueOf(locking);
@@ -79,6 +74,6 @@ public class FileAppender extends Output
         if (manager == null) {
             return null;
         }
-        return new FileAppender(name, layout, filters, manager, fileName, handleExceptions, isFlush);
+        return new FileAppender(name, layout, filter, manager, fileName, handleExceptions, isFlush);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java Tue Oct 25 07:41:10 2011
@@ -16,13 +16,13 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.layout.SerializedLayout;
 import org.apache.logging.log4j.core.net.JMSQueueManager;
 
@@ -34,9 +34,9 @@ public class JMSQueueAppender extends Ap
 
     private final JMSQueueManager manager;
 
-    public JMSQueueAppender(String name, Filters filters, Layout layout, JMSQueueManager manager,
+    public JMSQueueAppender(String name, Filter filter, Layout layout, JMSQueueManager manager,
                             boolean handleExceptions) {
-        super(name, filters, layout, handleExceptions);
+        super(name, filter, layout, handleExceptions);
         this.manager = manager;
     }
 
@@ -64,7 +64,7 @@ public class JMSQueueAppender extends Ap
                                                   @PluginAttr("userName") String userName,
                                                   @PluginAttr("password") String password,
                                                   @PluginElement("layout") Layout layout,
-                                                  @PluginElement("filters") Filters filters,
+                                                  @PluginElement("filters") Filter filter,
                                                   @PluginAttr("suppressExceptions") String suppress) {
 
         String name = "JMSQueue" + factoryBindingName + "." + queueBindingName;
@@ -77,6 +77,6 @@ public class JMSQueueAppender extends Ap
         if (layout == null) {
             layout = SerializedLayout.createLayout();
         }
-        return new JMSQueueAppender(name, filters, layout, manager, handleExceptions);
+        return new JMSQueueAppender(name, filter, layout, manager, handleExceptions);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java Tue Oct 25 07:41:10 2011
@@ -16,13 +16,13 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.layout.SerializedLayout;
 import org.apache.logging.log4j.core.net.JMSTopicManager;
 
@@ -34,9 +34,9 @@ public class JMSTopicAppender extends Ap
 
     private final JMSTopicManager manager;
 
-    public JMSTopicAppender(String name, Filters filters, Layout layout, JMSTopicManager manager,
+    public JMSTopicAppender(String name, Filter filter, Layout layout, JMSTopicManager manager,
                             boolean handleExceptions) {
-        super(name, filters, layout, handleExceptions);
+        super(name, filter, layout, handleExceptions);
         this.manager = manager;
     }
 
@@ -64,7 +64,7 @@ public class JMSTopicAppender extends Ap
                                                   @PluginAttr("userName") String userName,
                                                   @PluginAttr("password") String password,
                                                   @PluginElement("layout") Layout layout,
-                                                  @PluginElement("filters") Filters filters,
+                                                  @PluginElement("filters") Filter filter,
                                                   @PluginAttr("suppressExceptions") String suppress) {
 
         String name = "JMSTopic" + factoryBindingName + "." + topicBindingName;
@@ -77,6 +77,6 @@ public class JMSTopicAppender extends Ap
         if (layout == null) {
             layout = SerializedLayout.createLayout();
         }
-        return new JMSTopicAppender(name, filters, layout, manager, handleExceptions);
+        return new JMSTopicAppender(name, filter, layout, manager, handleExceptions);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamAppender.java Tue Oct 25 07:41:10 2011
@@ -16,14 +16,10 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import org.apache.logging.log4j.core.ErrorHandler;
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.filter.Filters;
 
-import java.io.IOException;
-import java.io.OutputStream;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -61,9 +57,9 @@ public abstract class OutputStreamAppend
      * @param layout The layout to format the message.
      * @param manager The OutputStreamManager.
      */
-    public OutputStreamAppender(String name, Layout layout, Filters filters, boolean handleException,
+    public OutputStreamAppender(String name, Layout layout, Filter filter, boolean handleException,
                                 boolean immediateFlush, OutputStreamManager manager) {
-        super(name, filters, layout, handleException);
+        super(name, filter, layout, handleException);
         if (layout != null) {
             manager.setHeader(layout.getHeader());
             manager.setFooter(layout.getFooter());

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java Tue Oct 25 07:41:10 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy;
@@ -26,7 +27,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 
 /**
  *
@@ -41,9 +41,9 @@ public class RollingFileAppender extends
     private final boolean bufferedIO;
 
     public RollingFileAppender(String name, Layout layout, TriggeringPolicy policy, RolloverStrategy strategy,
-                               Filters filters, RollingFileManager manager, String fileName, String filePattern,
+                               Filter filter, RollingFileManager manager, String fileName, String filePattern,
                                boolean handleException, boolean immediateFlush, boolean isBuffered) {
-        super(name, layout, filters, handleException, immediateFlush, manager);
+        super(name, layout, filter, handleException, immediateFlush, manager);
         this.fileName = fileName;
         this.filePattern = filePattern;
         this.policy = policy;
@@ -73,7 +73,7 @@ public class RollingFileAppender extends
                                               @PluginElement("policy") TriggeringPolicy policy,
                                               @PluginElement("strategy") RolloverStrategy strategy,
                                               @PluginElement("layout") Layout layout,
-                                              @PluginElement("filters") Filters filters,
+                                              @PluginElement("filter") Filter filter,
                                               @PluginAttr("suppressExceptions") String suppress) {
 
         boolean isAppend = append == null ? true : Boolean.valueOf(append);
@@ -110,7 +110,7 @@ public class RollingFileAppender extends
             return null;
         }
 
-        return new RollingFileAppender(name, layout, policy, strategy, filters, manager, fileName, filePattern,
+        return new RollingFileAppender(name, layout, policy, strategy, filter, manager, fileName, filePattern,
             handleExceptions, isFlush, isBuffered);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java Tue Oct 25 07:41:10 2011
@@ -16,20 +16,18 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.layout.SerializedLayout;
 import org.apache.logging.log4j.core.net.AbstractSocketManager;
 import org.apache.logging.log4j.core.net.DatagramSocketManager;
 import org.apache.logging.log4j.core.net.Protocol;
 import org.apache.logging.log4j.core.net.TCPSocketManager;
 
-import java.net.ProtocolException;
-
 /**
  *
  */
@@ -37,9 +35,9 @@ import java.net.ProtocolException;
 public class SocketAppender extends OutputStreamAppender {
 
 
-    public SocketAppender(String name, Layout layout, Filters filters, AbstractSocketManager manager,
+    public SocketAppender(String name, Layout layout, Filter filter, AbstractSocketManager manager,
                           boolean handleException, boolean immediateFlush) {
-        super(name, layout, filters, handleException, immediateFlush, manager);
+        super(name, layout, filter, handleException, immediateFlush, manager);
 
     }
 
@@ -52,7 +50,7 @@ public class SocketAppender extends Outp
                                                 @PluginAttr("immediateFlush") String immediateFlush,
                                                 @PluginAttr("suppressExceptions") String suppress,
                                                 @PluginElement("layout") Layout layout,
-                                                @PluginElement("filters") Filters filters) {
+                                                @PluginElement("filters") Filter filter) {
 
         boolean isFlush = immediateFlush == null ? true : Boolean.valueOf(immediateFlush);;
         boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
@@ -71,7 +69,7 @@ public class SocketAppender extends Outp
         if (manager == null) {
             return null;
         }
-        return new SocketAppender(name, layout, filters, manager, handleExceptions, isFlush);
+        return new SocketAppender(name, layout, filter, manager, handleExceptions, isFlush);
     }
 
     protected static AbstractSocketManager createSocketManager(String protocol, String host, int port, int delay) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java Tue Oct 25 07:41:10 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.core.appender;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -23,7 +24,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.layout.RFC5424Layout;
 import org.apache.logging.log4j.core.layout.SyslogLayout;
 import org.apache.logging.log4j.core.net.AbstractSocketManager;
@@ -40,9 +40,9 @@ public class SyslogAppender extends Sock
 
     public static final String RFC5424 = "RFC5424";
 
-    public SyslogAppender(String name, Layout layout, Filters filters,
+    public SyslogAppender(String name, Layout layout, Filter filter,
                           boolean handleException, boolean immediateFlush, AbstractSocketManager manager) {
-        super(name, layout, filters, manager, handleException, immediateFlush);
+        super(name, layout, filter, manager, handleException, immediateFlush);
 
     }
 
@@ -67,7 +67,7 @@ public class SyslogAppender extends Sock
                                                 @PluginAttr("mdcIncludes") String includes,
                                                 @PluginAttr("mdcRequired") String required,
                                                 @PluginAttr("format") String format,
-                                                @PluginElement("filters") Filters filters,
+                                                @PluginElement("filters") Filter filter,
                                                 @PluginConfiguration Configuration config,
                                                 @PluginAttr("charset") String charset) {
 
@@ -97,7 +97,7 @@ public class SyslogAppender extends Sock
             return null;
         }
 
-        return new SyslogAppender(name, layout, filters, handleExceptions, isFlush, manager);
+        return new SyslogAppender(name, layout, filter, handleExceptions, isFlush, manager);
     }
 
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java Tue Oct 25 07:41:10 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.core.appender.flume;
 
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.AppenderBase;
@@ -23,7 +24,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.layout.RFC5424Layout;
 
 import java.net.InetAddress;
@@ -52,10 +52,10 @@ public class FlumeAvroAppender extends A
 
     private final int retries;
 
-    private FlumeAvroAppender(String name, Filters filters, Layout layout, boolean handleException,
+    private FlumeAvroAppender(String name, Filter filter, Layout layout, boolean handleException,
                               String hostname, String includes, String excludes, String required, String mdcPrefix,
                               String eventPrefix, boolean compress, int delay, int retries, FlumeAvroManager manager) {
-        super(name, filters, layout, handleException);
+        super(name, filter, layout, handleException);
         this.manager = manager;
         this.mdcIncludes = includes;
         this.mdcExcludes = excludes;
@@ -95,7 +95,7 @@ public class FlumeAvroAppender extends A
                                                    @PluginAttr("eventPrefix") String eventPrefix,
                                                    @PluginAttr("compress") String compressBody,
                                                    @PluginElement("layout") Layout layout,
-                                                   @PluginElement("filters") Filters filters) {
+                                                   @PluginElement("filters") Filter filter) {
 
         String hostname;
         try {
@@ -129,7 +129,7 @@ public class FlumeAvroAppender extends A
         if (manager == null) {
             return null;
         }
-        return new FlumeAvroAppender(name, filters, layout,  handleExceptions, hostname, includes,
+        return new FlumeAvroAppender(name, filter, layout,  handleExceptions, hostname, includes,
             excludes, required, mdcPrefix, eventPrefix, compress, reconnectDelay, retries, manager);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/Routes.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/Routes.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/Routes.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/Routes.java Tue Oct 25 07:41:10 2011
@@ -49,7 +49,7 @@ public class Routes {
     }
 
     public String toString() {
-        StringBuilder sb = new StringBuilder("Routes={");
+        StringBuilder sb = new StringBuilder("{");
         boolean first = true;
         for (Route route : routes) {
             if ((!first)) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java Tue Oct 25 07:41:10 2011
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.filter.Filters;
+import org.apache.logging.log4j.core.filter.CompositeFilter;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -48,7 +48,7 @@ public class RoutingAppender extends App
     private final Configuration config;
     private ConcurrentMap<String, AppenderControl> appenders = new ConcurrentHashMap<String, AppenderControl>();
 
-    private RoutingAppender(String name, Filters filters, boolean handleException, Routes routes,
+    private RoutingAppender(String name, CompositeFilter filters, boolean handleException, Routes routes,
                             Configuration config) {
         super(name, filters, null, handleException);
         this.routes = routes;
@@ -162,7 +162,7 @@ public class RoutingAppender extends App
                                           @PluginAttr("suppressExceptions") String suppress,
                                           @PluginElement("routes") Routes routes,
                                           @PluginConfiguration Configuration config,
-                                          @PluginElement("filters") Filters filters) {
+                                          @PluginElement("filters") CompositeFilter filters) {
 
         boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/AppenderControl.java Tue Oct 25 07:41:10 2011
@@ -18,14 +18,11 @@ package org.apache.logging.log4j.core.co
 
 import org.apache.logging.log4j.core.ErrorHandler;
 import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Lifecycle;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.AppenderRuntimeException;
 import org.apache.logging.log4j.core.appender.DefaultErrorHandler;
-import org.apache.logging.log4j.core.filter.Filterable;
-
-import java.util.Iterator;
+import org.apache.logging.log4j.core.filter.Filtering;
 
 /**
  * Wraps appenders with details the appender implementation shouldn't need to know about.
@@ -74,17 +71,7 @@ public class AppenderControl {
                 }
             }
 
-            Filter.Result result = Filter.Result.NEUTRAL;
-            if (appender instanceof Filterable) {
-                Iterator<Filter> iter = ((Filterable)appender).getFilters();
-                while (iter.hasNext()) {
-                    result = iter.next().filter(event);
-                    if (result != Filter.Result.NEUTRAL) {
-                        break;
-                    }
-                }
-            }
-            if (result == Filter.Result.DENY) {
+            if (appender instanceof Filtering && ((Filtering) appender).isFiltered(event)) {
                 return;
             }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java Tue Oct 25 07:41:10 2011
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.co
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Lifecycle;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
@@ -29,7 +30,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginType;
 import org.apache.logging.log4j.core.config.plugins.PluginValue;
 import org.apache.logging.log4j.core.filter.Filterable;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.core.helpers.NameUtil;
 import org.apache.logging.log4j.core.lookup.Interpolator;
 import org.apache.logging.log4j.core.lookup.StrLookup;
@@ -93,11 +93,14 @@ public class BaseConfiguration extends F
         pluginManager.collectPlugins();
         setup();
         doConfigure();
+        for (LoggerConfig logger: loggers.values()) {
+            logger.startFilter();
+        }
         for (Appender appender : appenders.values()) {
             appender.start();
         }
 
-        startFilters();
+        startFilter();
     }
 
     /**
@@ -106,11 +109,12 @@ public class BaseConfiguration extends F
     public void stop() {
         for (LoggerConfig logger : loggers.values()) {
             logger.clearAppenders();
+            logger.stopFilter();
         }
         for (Appender appender : appenders.values()) {
             appender.stop();
         }
-        stopFilters();
+        stopFilter();
     }
 
     protected void setup() {
@@ -145,8 +149,8 @@ public class BaseConfiguration extends F
             }
             if (child.getName().equalsIgnoreCase("appenders")) {
                 appenders = (ConcurrentMap<String, Appender>) child.getObject();
-            } else if (child.getName().equalsIgnoreCase("filters")) {
-                setFilters((Filters) child.getObject());
+            } else if (child.getObject() instanceof Filter) {
+                addFilter((Filter) child.getObject());
             } else if (child.getName().equalsIgnoreCase("loggers")) {
                 Loggers l = (Loggers) child.getObject();
                 loggers = l.getMap();
@@ -180,6 +184,7 @@ public class BaseConfiguration extends F
                     logger.error("Unable to locate appender " + ref + " for logger " + l.getName());
                 }
             }
+
         }
 
         setParents();
@@ -288,6 +293,7 @@ public class BaseConfiguration extends F
         String name = logger.getName();
         LoggerConfig lc = getLoggerConfig(name);
         if (lc.getName().equals(name)) {
+
             lc.addFilter(filter);
         } else {
             LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive());
@@ -637,7 +643,7 @@ public class BaseConfiguration extends F
                             PluginType childType = child.getType();
                             if (elem.value().equals(childType.getElementName()) ||
                                 parmClass.isAssignableFrom(childType.getPluginClass())) {
-                                sb.append(child.toString());
+                                sb.append(child.getName()).append("(").append(child.toString()).append(")");
                                 present = true;
                                 used.add(child);
                                 parms[index] = child.getObject();
@@ -683,8 +689,9 @@ public class BaseConfiguration extends F
                 if (used.contains(child)) {
                     continue;
                 }
-
-                logger.error("node.getName()" + " contains invalid element " + child.getName());
+                String nodeType = node.getType().getElementName();
+                String start = nodeType.equals(node.getName()) ? node.getName() : nodeType + " " + node.getName();
+                logger.error(start + " has no parameter that matches element " + child.getName());
             }
         }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java Tue Oct 25 07:41:10 2011
@@ -21,6 +21,8 @@ import org.apache.logging.log4j.LogManag
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.filter.Filterable;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.LogEventFactory;
@@ -28,8 +30,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
-import org.apache.logging.log4j.core.filter.Filterable;
-import org.apache.logging.log4j.core.filter.Filters;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.message.Message;
 
@@ -79,12 +79,12 @@ public class LoggerConfig extends Filter
         this.additive = additive;
     }
 
-    protected LoggerConfig(String name, List<String> appenders, Filters filters, Level level,
+    protected LoggerConfig(String name, List<String> appenders, Filter filter, Level level,
                            boolean additive) {
+        super(filter);
         this.logEventFactory = this;
         this.name = name;
         this.appenderRefs = appenders;
-        setFilters(filters);
         this.level = level;
         this.additive = additive;
     }
@@ -274,7 +274,7 @@ public class LoggerConfig extends Filter
      * @param loggerLevel The Level to be associated with the Logger.
      * @param loggerName The name of the Logger.
      * @param refs An array of Appender names.
-     * @param filters A container for Filters.
+     * @param filter A Filter.
      * @return A new LoggerConfig.
      */
     @PluginFactory
@@ -282,7 +282,7 @@ public class LoggerConfig extends Filter
                                             @PluginAttr("level") String loggerLevel,
                                             @PluginAttr("name") String loggerName,
                                             @PluginElement("appender-ref") String[] refs,
-                                            @PluginElement("filters") Filters filters) {
+                                            @PluginElement("filters") Filter filter) {
         if (loggerName == null) {
             logger.error("Loggers cannot be configured without a name");
             return null;
@@ -293,7 +293,7 @@ public class LoggerConfig extends Filter
         String name = loggerName.equals("root") ? "" : loggerName;
         boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
 
-        return new LoggerConfig(name, appenderRefs, filters, level, additive);
+        return new LoggerConfig(name, appenderRefs, filter, level, additive);
     }
 
     /**
@@ -306,12 +306,12 @@ public class LoggerConfig extends Filter
         public static LoggerConfig createLogger(@PluginAttr("additivity") String additivity,
                                             @PluginAttr("level") String loggerLevel,
                                             @PluginElement("appender-ref") String[] refs,
-                                            @PluginElement("filters") Filters filters) {
+                                            @PluginElement("filters") Filter filter) {
             List<String> appenderRefs = Arrays.asList(refs);
             Level level = loggerLevel == null ? Level.ERROR : Level.valueOf(loggerLevel.toUpperCase());
             boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
 
-            return new LoggerConfig(LogManager.ROOT_LOGGER_NAME, appenderRefs, filters, level, additive);
+            return new LoggerConfig(LogManager.ROOT_LOGGER_NAME, appenderRefs, filter, level, additive);
         }
     }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java Tue Oct 25 07:41:10 2011
@@ -54,7 +54,7 @@ import java.util.concurrent.TimeUnit;
  * </code><br>
  */
 
-@Plugin(name = "Burst", type = "Core", elementType = "filter")
+@Plugin(name = "BurstFilter", type = "Core", elementType = "filter", printObject = true)
 public class BurstFilter extends FilterBase {
 
     private static final long NANOS_IN_SECONDS =  1000000000;
@@ -149,6 +149,10 @@ public class BurstFilter extends FilterB
         }
     }
 
+    public String toString() {
+        return "level=" + level.toString() + ", interval=" + burstInterval + ", max=" + history.size();
+    }
+
     /**
      * Delay object to represent each log event that has occurred within the timespan.
      */

Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/CompositeFilter.java (from r1147720, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filters.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/CompositeFilter.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/CompositeFilter.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filters.java&r1=1147720&r2=1188557&rev=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filters.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/CompositeFilter.java Tue Oct 25 07:41:10 2011
@@ -16,10 +16,16 @@
  */
 package org.apache.logging.log4j.core.filter;
 
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Lifecycle;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.Logger;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.message.Message;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -31,18 +37,19 @@ import java.util.List;
  *
  */
 @Plugin(name="filters", type="Core", printObject=true)
-public class Filters implements Iterable<Filter> {
+public class CompositeFilter implements Iterable<Filter>, Filter, Lifecycle {
 
     private final List<Filter> filters;
     private final boolean hasFilters;
-    public static final Filters EMPTY_FILTERS = new Filters();
 
-    private Filters() {
+    private boolean isStarted;
+
+    private CompositeFilter() {
         this.filters = new ArrayList<Filter>();
         this.hasFilters = false;
     }
 
-    private Filters(List<Filter> filters) {
+    private CompositeFilter(List<Filter> filters) {
         if (filters == null) {
             this.filters = Collections.unmodifiableList(new ArrayList<Filter>());
             this.hasFilters = false;
@@ -52,16 +59,16 @@ public class Filters implements Iterable
         this.hasFilters = this.filters.size() > 0;
     }
 
-    public Filters addFilter(Filter filter) {
+    public CompositeFilter addFilter(Filter filter) {
         List<Filter> filters = new ArrayList<Filter>(this.filters);
         filters.add(filter);
-        return new Filters(Collections.unmodifiableList(filters));
+        return new CompositeFilter(Collections.unmodifiableList(filters));
     }
 
-    public Filters removeFilter(Filter filter) {
+    public CompositeFilter removeFilter(Filter filter) {
         List<Filter> filters = new ArrayList<Filter>(this.filters);
         filters.remove(filter);
-        return new Filters(Collections.unmodifiableList(filters));
+        return new CompositeFilter(Collections.unmodifiableList(filters));
     }
 
     public Iterator<Filter> iterator() {
@@ -80,6 +87,120 @@ public class Filters implements Iterable
         return filters.size();
     }
 
+    public void start() {
+        for (Filter filter : filters) {
+            if (filter instanceof Lifecycle) {
+                ((Lifecycle) filter).start();
+            }
+        }
+        isStarted = true;
+    }
+
+    public void stop() {
+        for (Filter filter : filters) {
+            if (filter instanceof Lifecycle) {
+                ((Lifecycle) filter).stop();
+            }
+        }
+        isStarted = false;
+    }
+
+    public boolean isStarted() {
+        return isStarted;
+    }
+
+    /**
+     * Return the result that should be returned when the filter does not match the event.
+     * @return the Result that should be returned when the filter does not match the event.
+     */
+    public Result getOnMismatch() {
+        return Result.NEUTRAL;
+    }
+    /**
+     * Return the result that should be returned when the filter matches the event.
+     * @return the Result that should be returned when the filter matches the event.
+     */
+    public Result getOnMatch() {
+        return Result.NEUTRAL;
+    }
+
+    /**
+     * Filter an event.
+     * @param logger The Logger.
+     * @param level The event logging Level.
+     * @param marker The Marker for the event or null.
+     * @param msg String text to filter on.
+     * @param params An array of parameters or null.
+     * @return the Result.
+     */
+    public Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) {
+        Result result = Result.NEUTRAL;
+        for (Filter filter : filters) {
+            result = filter.filter(logger, level, marker, msg, params);
+            if (result == Result.ACCEPT || result == Result.DENY) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Filter an event.
+     * @param logger The Logger.
+     * @param level The event logging Level.
+     * @param marker The Marker for the event or null.
+     * @param msg Any Object.
+     * @param t A Throwable or null.
+     * @return the Result.
+     */
+    public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
+        Result result = Result.NEUTRAL;
+        for (Filter filter : filters) {
+            result = filter.filter(logger, level, marker, msg, t);
+            if (result == Result.ACCEPT || result == Result.DENY) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Filter an event.
+     * @param logger The Logger.
+     * @param level The event logging Level.
+     * @param marker The Marker for the event or null.
+     * @param msg The Message
+     * @param t A Throwable or null.
+     * @return the Result.
+     */
+    public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
+        Result result = Result.NEUTRAL;
+        for (Filter filter : filters) {
+            result = filter.filter(logger, level, marker, msg, t);
+            if (result == Result.ACCEPT || result == Result.DENY) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Filter an event.
+     * @param event The Event to filter on.
+     * @return the Result.
+     */
+    public Result filter(LogEvent event) {
+        Result result = Result.NEUTRAL;
+        for (Filter filter : filters) {
+            result = filter.filter(event);
+            if (result == Result.ACCEPT || result == Result.DENY) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         for (Filter filter : filters) {
@@ -97,9 +218,9 @@ public class Filters implements Iterable
     }
 
     @PluginFactory
-    public static Filters createFilters(@PluginElement("filters") Filter[] filters) {
+    public static CompositeFilter createFilters(@PluginElement("filters") Filter[] filters) {
         List<Filter> f = filters == null || filters.length == 0 ? new ArrayList<Filter>() : Arrays.asList(filters);
-        return new Filters(f);
+        return new CompositeFilter(f);
     }
 
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java Tue Oct 25 07:41:10 2011
@@ -33,7 +33,7 @@ import java.util.Map;
 /**
  *
  */
-@Plugin(name="StructuredData", type="Core", elementType="filter")
+@Plugin(name="DynamicThresholdFilter", type="Core", elementType="filter", printObject = true)
 public class DynamicThresholdFilter extends FilterBase {
     private Map<String, Level> levelMap = new HashMap<String, Level>();
     private Level defaultThreshold = Level.ERROR;
@@ -84,6 +84,25 @@ public class DynamicThresholdFilter exte
 
     }
 
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("key=").append(key);
+        sb.append(", default=").append(defaultThreshold);
+        if (levelMap.size() > 0) {
+            sb.append("{");
+            boolean first = true;
+            for (Map.Entry<String, Level> entry : levelMap.entrySet()) {
+                if (!first) {
+                    sb.append(", ");
+                    first = false;
+                }
+                sb.append(entry.getKey()).append("=").append(entry.getValue());
+            }
+            sb.append("}");
+        }
+        return sb.toString();
+    }
+
     @PluginFactory
     public static DynamicThresholdFilter createFilter(@PluginAttr("key") String key,
                                                       @PluginElement("pairs") ValueLevelPair[] pairs,

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filterable.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filterable.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filterable.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filterable.java Tue Oct 25 07:41:10 2011
@@ -25,69 +25,71 @@ import java.util.Iterator;
 /**
  *
  */
-public class Filterable {
-    private volatile Filters filters = Filters.EMPTY_FILTERS;
+public class Filterable implements Filtering {
 
-    public synchronized void addFilter(Filter filter) {
-        filters = filters.addFilter(filter);
-    }
+    private volatile Filter filter = null;
 
-    public synchronized void removeFilter(Filter filter) {
-        filters = filters.removeFilter(filter);
+    protected Filterable(Filter filter) {
+        this.filter = filter;
     }
 
-    public synchronized void clearFilters() {
-        filters = Filters.EMPTY_FILTERS;
+    protected Filterable() {
     }
 
-    public Iterator<Filter> getFilters() {
-        return filters.iterator();
+    /**
+     * Return the Filter
+     * @return the Filter.
+     */
+    public Filter getFilter() {
+        return filter;
     }
 
-    public boolean hasFilters() {
-        return filters.hasFilters();
-    }
-
-    public int filterCount() {
-        return filters.size();
+    public synchronized void addFilter(Filter filter) {
+        if (this.filter == null) {
+            this.filter = filter;
+        } else if (filter instanceof CompositeFilter) {
+            this.filter = ((CompositeFilter) this.filter).addFilter(filter);
+        } else {
+            Filter[] filters = new Filter[] {this.filter, filter};
+            this.filter = CompositeFilter.createFilters(filters);
+        }
     }
 
-    protected void startFilters() {
-        Filters f = filters;
-        if (f.hasFilters()) {
-            for (Filter filter : f) {
-                if ((filter instanceof Lifecycle)) {
-                    ((Lifecycle)filter).start();
-                }
+    public synchronized void removeFilter(Filter filter) {
+        if (this.filter == filter) {
+            this.filter = null;
+        } else if (filter instanceof CompositeFilter) {
+            CompositeFilter composite = (CompositeFilter) filter;
+            composite = composite.removeFilter(filter);
+            if (composite.size() > 1) {
+                this.filter = composite;
+            } else if (composite.size() == 1) {
+                Iterator<Filter> iter = composite.iterator();
+                this.filter = iter.next();
+            } else {
+                this.filter = null;
             }
         }
     }
 
-    protected void stopFilters() {
-        Filters f = filters;
-        if (f.hasFilters()) {
-            for (Filter filter : f) {
-                if ((filter instanceof Lifecycle)) {
-                    ((Lifecycle)filter).stop();
-                }
-            }
-        }
+    public boolean hasFilter() {
+        return filter != null;
     }
 
-    protected synchronized void setFilters(Filters newFilters) {
-        filters = newFilters == null ? Filters.EMPTY_FILTERS : newFilters;
+    public void startFilter() {
+       if (filter != null && filter instanceof Lifecycle) {
+           ((Lifecycle) filter).start();
+       }
     }
 
-    protected boolean isFiltered(LogEvent event) {
-        Filters f = filters;
-        if (f.hasFilters()) {
-            for (Filter filter : f) {
-                if (filter.filter(event) == Filter.Result.DENY) {
-                    return true;
-                }
-            }
-        }
-        return false;
+    public void stopFilter() {
+       if (filter != null && filter instanceof Lifecycle) {
+           ((Lifecycle) filter).stop();
+       }
+    }
+
+    public boolean isFiltered(LogEvent event) {
+        return filter != null && filter.filter(event) == Filter.Result.DENY;
     }
 
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filtering.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filtering.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filtering.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/Filtering.java Tue Oct 25 07:41:10 2011
@@ -1,6 +1,7 @@
 package org.apache.logging.log4j.core.filter;
 
 import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.LogEvent;
 
 import java.util.Iterator;
 
@@ -10,7 +11,7 @@ import java.util.Iterator;
 public interface Filtering {
 
     /**
-     * Adds a new Filter.
+     * Adds a new Filter. If a Filter already exists it is converted to a CompositeFilter.
      * @param filter The Filter to add.
      */
     void addFilter(Filter filter);
@@ -22,25 +23,21 @@ public interface Filtering {
     void removeFilter(Filter filter);
 
     /**
-     * Removes all Filters.
-     */
-    void clearFilters();
-
-    /**
      * Returns an Iterator for all the Filters.
      * @return an Iterator for all the Filters.
      */
-    Iterator<Filter> getFilters();
+    Filter getFilter();
 
     /**
-     * Determins if any Filters are present.
-     * @return true if any Filters are present, false otherwise.
+     * Determine if a Filter is present.
+     * @return true if a Filter is present, false otherwise.
      */
-    boolean hasFilters();
+    boolean hasFilter();
 
     /**
-     * Returns the number of Filters associated with the Object.
-     * @return the number of Filters associated with the Object.
+     * Determines if the event should be filtered.
+     * @param event The LogEvent.
+     * @return true if the event should be filtered, false otherwise.
      */
-    int filterCount();
+    boolean isFiltered(LogEvent event);
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java Tue Oct 25 07:41:10 2011
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.message.
  * configured marker as a parent.
  *
  */
-@Plugin(name="Marker", type="Core", elementType="filter", printObject=true)
+@Plugin(name="MarkerFilter", type="Core", elementType="filter", printObject=true)
 public class MarkerFilter extends FilterBase {
 
     private static final String LEVEL = "level";

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java Tue Oct 25 07:41:10 2011
@@ -36,7 +36,7 @@ import java.util.regex.Pattern;
  * (false). The default is false.
  *
  */
-@Plugin(name="Regex", type="Core", elementType="filter")
+@Plugin(name="RegexFilter", type="Core", elementType="filter", printObject = true)
 public class RegexFilter extends FilterBase {
 
     private final Pattern pattern;
@@ -75,6 +75,13 @@ public class RegexFilter extends FilterB
         return m.matches() ? onMatch : onMismatch;
     }
 
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("useRaw=").append(useRawMessage);
+        sb.append(", pattern=").append(pattern.toString());
+        return sb.toString();
+    }
+
     @PluginFactory
     public static RegexFilter createFilter(@PluginAttr("regex") String regex,
                                            @PluginAttr("useRawMsg") String useRawMsg,

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java?rev=1188557&r1=1188556&r2=1188557&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java Tue Oct 25 07:41:10 2011
@@ -32,7 +32,7 @@ import java.util.Map;
 /**
  *
  */
-@Plugin(name="StructuredData", type="Core", elementType="filter")
+@Plugin(name="StructuredDataFilter", type="Core", elementType="filter", printObject=true)
 public class StructuredDataFilter extends FilterBase {
     private final Map<String, Object> map;
 
@@ -86,6 +86,24 @@ public class StructuredDataFilter extend
         return match ? onMatch : onMismatch;
     }
 
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("isAnd=").append(isAnd);
+        if (map.size() > 0) {
+            sb.append(", {");
+            boolean first = true;
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
+                if (!first) {
+                    sb.append(", ");
+                }
+                first = false;
+                sb.append(entry.getKey()).append("=").append(entry.getValue());
+            }
+            sb.append("}");
+        }
+        return sb.toString();
+    }
+
     @PluginFactory
     public static StructuredDataFilter createFilter(@PluginAttr("pairs") KeyValuePair[] pairs,
                                                     @PluginAttr("operator") String oper,



Mime
View raw message