[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, eventAlteringTurboFilters, created. release_0.9.19-33-gc08e014

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Wed Mar 31 22:44:54 CEST 2010


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

The branch, eventAlteringTurboFilters has been created
        at  c08e014747419bacec338a5104184535de8fcdce (commit)

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

commit c08e014747419bacec338a5104184535de8fcdce
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Wed Mar 31 22:38:54 2010 +0200

    - started work on http://jira.qos.ch/browse/LBCLASSIC-195
    
    The decide() method in TurboFilter now admits a LoggingEvent as an
    argument instead of LoggingEvent constituents parts
    
    The performance of logging when no turbo filters are installed remains
    unchanged. However, an extra 30 nanoseconds (on a fast machine) are
    added when there are one or more registered turbo filters which
    corresponds to the cost of creating a LoggingEvent and garbage
    collecting it even if the event is not used.
    
    The extra cost is deemed acceptable given the flexibility it provides.

diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 0d2957f..f2cdcbc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -80,12 +80,18 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
    * synchronized on 'this' (Logger) protecting against simultaneous
    * re-configuration of this logger (a very unlikely scenario).
    * 
-   * <p> It is further assumed that the AppenderAttachableImpl is responsible
-   * for its internal synchronization and thread safety. Thus, we can get away
-   * with *not* synchronizing on the 'aai' (check null/ read) because <p> 1) the
-   * 'aai' variable is immutable once set to non-null <p> 2) 'aai' is getAndSet
-   * only within addAppender which is synchronized <p> 3) all the other methods
-   * check whether 'aai' is null <p> 4) AppenderAttachableImpl is thread safe
+   * <p>
+   * It is further assumed that the AppenderAttachableImpl is responsible for
+   * its internal synchronization and thread safety. Thus, we can get away with
+   * *not* synchronizing on the 'aai' (check null/ read) because
+   * <p>
+   * 1) the 'aai' variable is immutable once set to non-null
+   * <p>
+   * 2) 'aai' is getAndSet only within addAppender which is synchronized
+   * <p>
+   * 3) all the other methods check whether 'aai' is null
+   * <p>
+   * 4) AppenderAttachableImpl is thread safe
    */
   private transient AppenderAttachableImpl<ILoggingEvent> aai;
   /**
@@ -158,17 +164,18 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
       // nothing to do;
       return;
     }
-    if(newLevel == null && isRootLogger()) {
-      throw new IllegalArgumentException("The level of the root logger cannot be set to null");
+    if (newLevel == null && isRootLogger()) {
+      throw new IllegalArgumentException(
+          "The level of the root logger cannot be set to null");
     }
-        
+
     level = newLevel;
     if (newLevel == null) {
       effectiveLevelInt = parent.effectiveLevelInt;
     } else {
       effectiveLevelInt = newLevel.levelInt;
     }
-    
+
     if (childrenList != null) {
       int len = childrenList.size();
       for (int i = 0; i < len; i++) {
@@ -203,8 +210,9 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
   }
 
   /**
-   * Remove all previously added appenders from this logger instance. <p/> This
-   * is useful when re-reading configuration information.
+   * Remove all previously added appenders from this logger instance.
+   * <p/>
+   * This is useful when re-reading configuration information.
    */
   public void detachAndStopAllAppenders() {
     if (aai != null) {
@@ -254,7 +262,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
    * Invoke all the appenders of this logger.
    * 
    * @param event
-   *                The event to log
+   *          The event to log
    */
   public void callAppenders(ILoggingEvent event) {
     int writes = 0;
@@ -291,7 +299,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
   static int getSeparatorIndexOf(String name) {
     return getSeparatorIndexOf(name, 0);
   }
-  
+
   /**
    * Get the position of the separator character, if any, starting at position
    * 'fromIndex'.
@@ -300,35 +308,35 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
    * @param fromIndex
    * @return
    */
-  static int getSeparatorIndexOf(String name, int  fromIndex) {
+  static int getSeparatorIndexOf(String name, int fromIndex) {
     int i = name.indexOf(CoreConstants.DOT, fromIndex);
-    if(i != -1) {
+    if (i != -1) {
       return i;
     } else {
       return name.indexOf(CoreConstants.DOLLAR, fromIndex);
     }
   }
-  
+
   /**
    * Create a child of this logger by suffix, that is, the part of the name
    * extending this logger. For example, if this logger is named "x.y" and the
    * lastPart is "z", then the created child logger will be named "x.y.z".
    * 
-   * <p> IMPORTANT: Calls to this method must be within a synchronized block on
-   * this logger.
+   * <p>
+   * IMPORTANT: Calls to this method must be within a synchronized block on this
+   * logger.
    * 
    * @param lastPart
-   *                the suffix (i.e. last part) of the child logger name. This
-   *                parameter may not include dots, i.e. the logger separator
-   *                character.
+   *          the suffix (i.e. last part) of the child logger name. This
+   *          parameter may not include dots, i.e. the logger separator
+   *          character.
    * @return
    */
   Logger createChildByLastNamePart(final String lastPart) {
     int i_index = getSeparatorIndexOf(lastPart);
     if (i_index != -1) {
       throw new IllegalArgumentException("Child name [" + lastPart
-          + " passed as parameter, may not include ["
-          + CoreConstants.DOT + "]");
+          + " passed as parameter, may not include [" + CoreConstants.DOT + "]");
     }
 
     if (childrenList == null) {
@@ -338,8 +346,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
     if (this.isRootLogger()) {
       childLogger = new Logger(lastPart, this, this.loggerContext);
     } else {
-      childLogger = new Logger(
-          name + CoreConstants.DOT + lastPart, this,
+      childLogger = new Logger(name + CoreConstants.DOT + lastPart, this,
           this.loggerContext);
     }
     childrenList.add(childLogger);
@@ -349,13 +356,13 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
 
   private void localLevelReset() {
     effectiveLevelInt = Level.DEBUG_INT;
-    if(isRootLogger()) {
+    if (isRootLogger()) {
       level = Level.DEBUG;
     } else {
       level = null;
     }
   }
-  
+
   void recursiveReset() {
     detachAndStopAllAppenders();
     localLevelReset();
@@ -375,8 +382,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
   static private final int DEFAULT_CHILD_ARRAY_SIZE = 5;
 
   Logger createChildByName(final String childName) {
-    int i_index = getSeparatorIndexOf(childName, this.name
-        .length() + 1);
+    int i_index = getSeparatorIndexOf(childName, this.name.length() + 1);
     if (i_index != -1) {
       throw new IllegalArgumentException("For logger [" + this.name
           + "] child name [" + childName
@@ -404,65 +410,95 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
       final Marker marker, final Level level, final String msg,
       final Object[] params, final Throwable t) {
 
-    final FilterReply decision = loggerContext
-        .getTurboFilterChainDecision_0_3OrMore(marker, this, level, msg,
-            params, t);
-
-    if (decision == FilterReply.NEUTRAL) {
+    LoggingEvent event = null;
+    if (loggerContext.turboFilterList.size() == 0) {
+   
       if (effectiveLevelInt > level.levelInt) {
         return;
       }
-    } else if (decision == FilterReply.DENY) {
-      return;
+      event = buildLoggingEvent(localFQCN, marker, level, msg, params, t);
+    } else {
+      event = buildLoggingEvent(localFQCN, marker, level, msg, params, t);
+      final FilterReply decision = loggerContext.turboFilterList
+          .getTurboFilterChainDecision(event);
+      if (decision == FilterReply.NEUTRAL) {
+        if (effectiveLevelInt > level.levelInt) {
+          return;
+        }
+      } else if (decision == FilterReply.DENY) {
+        return;
+      }
     }
-
-    buildLoggingEventAndAppend(localFQCN, marker, level, msg, params, t);
+    buildLoggingEventAndAppend(event);
   }
 
   private final void filterAndLog_1(final String localFQCN,
       final Marker marker, final Level level, final String msg,
       final Object param, final Throwable t) {
 
-    final FilterReply decision = loggerContext.getTurboFilterChainDecision_1(
-        marker, this, level, msg, param, t);
-
-    if (decision == FilterReply.NEUTRAL) {
+    LoggingEvent event = null;
+    if (loggerContext.turboFilterList.size() == 0) {
       if (effectiveLevelInt > level.levelInt) {
         return;
       }
-    } else if (decision == FilterReply.DENY) {
-      return;
+      event = buildLoggingEvent(localFQCN, marker, level, msg,
+          new Object[] { param }, t);
+    } else {
+      event = buildLoggingEvent(localFQCN, marker, level, msg,
+          new Object[] { param }, t);
+
+      final FilterReply decision = loggerContext.turboFilterList
+          .getTurboFilterChainDecision(event);
+      if (decision == FilterReply.NEUTRAL) {
+        if (effectiveLevelInt > level.levelInt) {
+          return;
+        }
+      } else if (decision == FilterReply.DENY) {
+        return;
+      }
     }
-
-    buildLoggingEventAndAppend(localFQCN, marker, level, msg,
-        new Object[] { param }, t);
+    buildLoggingEventAndAppend(event);
   }
 
   private final void filterAndLog_2(final String localFQCN,
       final Marker marker, final Level level, final String msg,
       final Object param1, final Object param2, final Throwable t) {
 
-    final FilterReply decision = loggerContext.getTurboFilterChainDecision_2(
-        marker, this, level, msg, param1, param2, t);
-
-    if (decision == FilterReply.NEUTRAL) {
+    LoggingEvent event = null;
+    if (loggerContext.turboFilterList.size() == 0) {
       if (effectiveLevelInt > level.levelInt) {
         return;
       }
-    } else if (decision == FilterReply.DENY) {
-      return;
+      event = buildLoggingEvent(localFQCN, marker, level, msg, new Object[] {
+          param1, param2 }, t);
+    } else {
+      event = buildLoggingEvent(localFQCN, marker, level, msg, new Object[] {
+          param1, param2 }, t);
+
+      final FilterReply decision = loggerContext.turboFilterList
+          .getTurboFilterChainDecision(event);
+      if (decision == FilterReply.NEUTRAL) {
+        if (effectiveLevelInt > level.levelInt) {
+          return;
+        }
+      } else if (decision == FilterReply.DENY) {
+        return;
+      }
     }
-
-    buildLoggingEventAndAppend(localFQCN, marker, level, msg, new Object[] {
-        param1, param2 }, t);
+    buildLoggingEventAndAppend(event);
   }
 
-  private void buildLoggingEventAndAppend(final String localFQCN,
+  private final LoggingEvent buildLoggingEvent(final String localFQCN,
       final Marker marker, final Level level, final String msg,
       final Object[] params, final Throwable t) {
     LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
     le.setMarker(marker);
-    callAppenders(le);
+    return le;
+  }
+
+  private void buildLoggingEventAndAppend(LoggingEvent event) {
+    event.secondaryInit();
+    callAppenders(event);
   }
 
   public void trace(String msg) {
@@ -792,8 +828,13 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
    * @return the reply given by the TurboFilters
    */
   private FilterReply callTurboFilters(Marker marker, Level level) {
-    return loggerContext.getTurboFilterChainDecision_0_3OrMore(marker, this,
-        level, null, null, null);
+    if (loggerContext.turboFilterList.size() == 0) {
+      return FilterReply.NEUTRAL;
+    } else {
+      LoggingEvent event = buildLoggingEvent(null, marker, level, null,
+          null, null);
+      return loggerContext.turboFilterList.getTurboFilterChainDecision(event);
+    }
   }
 
   /**
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java b/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
index b81c581..2defa6b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
@@ -21,7 +21,6 @@ import java.util.Hashtable;
 import java.util.List;
 
 import org.slf4j.ILoggerFactory;
-import org.slf4j.Marker;
 
 import ch.qos.logback.classic.spi.LoggerComparator;
 import ch.qos.logback.classic.spi.LoggerContextListener;
@@ -30,7 +29,6 @@ import ch.qos.logback.classic.spi.TurboFilterList;
 import ch.qos.logback.classic.turbo.TurboFilter;
 import ch.qos.logback.core.ContextBase;
 import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.spi.FilterReply;
 import ch.qos.logback.core.spi.LifeCycle;
 import ch.qos.logback.core.status.StatusListener;
 import ch.qos.logback.core.status.StatusManager;
@@ -60,7 +58,9 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
   private Hashtable<String, Logger> loggerCache;
 
   private LoggerContextVO loggerContextRemoteView;
-  private final TurboFilterList turboFilterList = new TurboFilterList();
+  
+  // allow the Logger class access to this list
+  final TurboFilterList turboFilterList = new TurboFilterList();
   private boolean packagingDataEnabled = true;
 
   private int maxCallerDataDepth = ClassicConstants.DEFAULT_MAX_CALLEDER_DATA_DEPTH;
@@ -250,36 +250,6 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
     turboFilterList.clear();
   }
 
-  final FilterReply getTurboFilterChainDecision_0_3OrMore(final Marker marker,
-      final Logger logger, final Level level, final String format,
-      final Object[] params, final Throwable t) {
-    if (turboFilterList.size() == 0) {
-      return FilterReply.NEUTRAL;
-    }
-    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
-        format, params, t);
-  }
-
-  final FilterReply getTurboFilterChainDecision_1(final Marker marker,
-      final Logger logger, final Level level, final String format,
-      final Object param, final Throwable t) {
-    if (turboFilterList.size() == 0) {
-      return FilterReply.NEUTRAL;
-    }
-    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
-        format, new Object[] { param }, t);
-  }
-
-  final FilterReply getTurboFilterChainDecision_2(final Marker marker,
-      final Logger logger, final Level level, final String format,
-      final Object param1, final Object param2, final Throwable t) {
-    if (turboFilterList.size() == 0) {
-      return FilterReply.NEUTRAL;
-    }
-    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
-        format, new Object[] { param1, param2 }, t);
-  }
-
   // === start listeners ==============================================
   public void addListener(LoggerContextListener listener) {
     loggerContextListenerList.add(listener);
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
index 867c9d2..d32d3bf 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
@@ -95,6 +95,7 @@ public class LoggingEvent implements ILoggingEvent {
 
   public LoggingEvent(String fqcn, Logger logger, Level level, String message,
       Throwable throwable, Object[] argArray) {
+    
     this.fqnOfLoggerClass = fqcn;
     this.loggerName = logger.getName();
     this.loggerContext = logger.getLoggerContext();
@@ -113,7 +114,9 @@ public class LoggingEvent implements ILoggingEvent {
 
     // bug 85 (we previously failed to set this.argumentArray)
     this.argumentArray = argArray;
+  }
 
+  public void secondaryInit() {
     timeStamp = System.currentTimeMillis();
 
     // the case is ugly but under the circumstances acceptable
@@ -121,7 +124,7 @@ public class LoggingEvent implements ILoggingEvent {
         .getMDCAdapter();
     mdcPropertyMap = logbackMDCAdapter.getPropertyMap();
   }
-
+  
   public void setArgumentArray(Object[] argArray) {
     if (this.argumentArray != null) {
       throw new IllegalStateException("argArray has been already set");
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
index d104ff4..1cefdab 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
@@ -15,10 +15,6 @@ package ch.qos.logback.classic.spi;
 
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.slf4j.Marker;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.turbo.TurboFilter;
 import ch.qos.logback.core.spi.FilterReply;
 
@@ -36,47 +32,16 @@ final public class TurboFilterList extends CopyOnWriteArrayList<TurboFilter> {
    * ACCEPT or DENY, then that value is returned. If all of the filters return
    * NEUTRAL, then NEUTRAL is returned.
    */
-  public final FilterReply getTurboFilterChainDecision(final Marker marker,
-      final Logger logger, final Level level, final String format,
-      final Object[] params, final Throwable t) {
-    
-    
-    final int size = size();
-//    if (size == 0) {
-//      return FilterReply.NEUTRAL;
-//    }
-    if (size == 1) {
-      try {
-        TurboFilter tf = get(0);
-        return tf.decide(marker, logger, level, format, params, t);
-      } catch (IndexOutOfBoundsException iobe) {
-        return FilterReply.NEUTRAL;
-      }
-    }
-    
+  public final FilterReply getTurboFilterChainDecision(final LoggingEvent event) {
     Object[] tfa = toArray();
     final int len = tfa.length;
     for (int i = 0; i < len; i++) {
-    //for (TurboFilter tf : this) {
       final TurboFilter tf = (TurboFilter) tfa[i];
-      final FilterReply r = tf.decide(marker, logger, level, format, params, t);
+      final FilterReply r = tf.decide(event);
       if (r == FilterReply.DENY || r == FilterReply.ACCEPT) {
         return r;
       }
     }
     return FilterReply.NEUTRAL;
   }
-
-  // public boolean remove(TurboFilter turboFilter) {
-  // return tfList.remove(turboFilter);
-  // }
-  //
-  // public TurboFilter remove(int index) {
-  // return tfList.remove(index);
-  // }
-  //
-  // final public int size() {
-  // return tfList.size();
-  // }
-
 }
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
index 939a7d3..21ee701 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
@@ -13,10 +13,7 @@
  */
 package ch.qos.logback.classic.turbo;
 
-import org.slf4j.Marker;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 /**
@@ -57,9 +54,8 @@ public class DuplicateMessageFilter extends TurboFilter {
   }
 
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String format, Object[] params, Throwable t) {
-    int count = msgCache.getMessageCountAndThenIncrement(format);
+  public FilterReply decide(LoggingEvent event) {
+    int count = msgCache.getMessageCountAndThenIncrement(event.getMessage());
     if (count <= allowedRepetitions) {
       return FilterReply.NEUTRAL;
     } else {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
index eb61702..bf4a845 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
@@ -13,40 +13,45 @@
  */
 package ch.qos.logback.classic.turbo;
 
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.core.spi.FilterReply;
-import org.slf4j.Marker;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.slf4j.MDC;
+import org.slf4j.Marker;
 
-import java.util.Map;
-import java.util.HashMap;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.spi.FilterReply;
 
 /**
  * This filter allows for efficient course grained filtering based on criteria
  * such as product name or company name that would be associated with requests
  * as they are processed.
  * 
- * <p> This filter will allow you to associate threshold levels to a key put in
- * the MDC. This key can be any value specified by the user. Furthermore, you
- * can pass MDC value and level threshold associations, which are then looked up
- * to find the level threshold to apply to the current logging request. If no
- * level threshold could be found, then a 'default' value specified by the user
- * is applied. We call this value 'levelAssociatedWithMDCValue'.
+ * <p>
+ * This filter will allow you to associate threshold levels to a key put in the
+ * MDC. This key can be any value specified by the user. Furthermore, you can
+ * pass MDC value and level threshold associations, which are then looked up to
+ * find the level threshold to apply to the current logging request. If no level
+ * threshold could be found, then a 'default' value specified by the user is
+ * applied. We call this value 'levelAssociatedWithMDCValue'.
  * 
- * <p> If 'levelAssociatedWithMDCValue' is higher or equal to the level of the
+ * <p>
+ * If 'levelAssociatedWithMDCValue' is higher or equal to the level of the
  * current logger request, the
  * {@link #decide(Marker, Logger, Level, String, Object[], Throwable) decide()}
- * method returns the value of {@link #getOnHigherOrEqual() onHigherOrEqual},
- * if it is lower then the value of {@link #getOnLower() onLower} is returned.
- * Both 'onHigherOrEqual' and 'onLower' can be set by the user. By default,
+ * method returns the value of {@link #getOnHigherOrEqual() onHigherOrEqual}, if
+ * it is lower then the value of {@link #getOnLower() onLower} is returned. Both
+ * 'onHigherOrEqual' and 'onLower' can be set by the user. By default,
  * 'onHigherOrEqual' is set to NEUTRAL and 'onLower' is set to DENY. Thus, if
  * the current logger request's level is lower than
  * 'levelAssociatedWithMDCValue', then the request is denied, and if it is
  * higher or equal, then this filter decides NEUTRAL letting subsequent filters
  * to make the decision on the fate of the logging request.
  * 
- * <p> The example below illustrates how logging could be enabled for only
+ * <p>
+ * The example below illustrates how logging could be enabled for only
  * individual users. In this example all events for logger names matching
  * "com.mycompany" will be logged if they are for 'user1' and at a level higher
  * than equals to DEBUG, and for 'user2' if they are at a level higher than or
@@ -220,21 +225,15 @@ public class DynamicThresholdFilter extends TurboFilter {
    * 
    * @{link #defaultThreshold} value.
    * 
-   * If no such value exists, then
+   *        If no such value exists, then
    * 
    * 
-   * @param marker
-   * @param logger
-   * @param level
-   * @param s
-   * @param objects
-   * @param throwable
+   * @param event
    * 
    * @return FilterReply - this filter's decision
    */
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String s, Object[] objects, Throwable throwable) {
+  public FilterReply decide(LoggingEvent event) {
 
     String mdcValue = MDC.get(this.key);
     if (!isStarted()) {
@@ -248,7 +247,7 @@ public class DynamicThresholdFilter extends TurboFilter {
     if (levelAssociatedWithMDCValue == null) {
       levelAssociatedWithMDCValue = defaultThreshold;
     }
-    if (level.isGreaterOrEqual(levelAssociatedWithMDCValue)) {
+    if (event.getLevel().isGreaterOrEqual(levelAssociatedWithMDCValue)) {
       return onHigherOrEqual;
     } else {
       return onLower;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
index 111db11..aafe4b3 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
@@ -14,10 +14,8 @@
 package ch.qos.logback.classic.turbo;
 
 import org.slf4j.MDC;
-import org.slf4j.Marker;
 
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 /**
@@ -49,7 +47,7 @@ public class MDCFilter extends MatchingFilter {
   String value;
   
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     if (MDCKey == null) {
       return FilterReply.NEUTRAL;
     }
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
index 8e133cb..747ab10 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
@@ -16,8 +16,7 @@ package ch.qos.logback.classic.turbo;
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
 
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 /**
@@ -38,11 +37,12 @@ public class MarkerFilter extends MatchingFilter {
   }
   
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     if(!isStarted()) {
       return FilterReply.NEUTRAL;
     }
     
+    Marker marker = event.getMarker();
     if(marker == null) {
       return onMismatch;
     } 
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
index cd04f93..82ea352 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
@@ -17,12 +17,9 @@ import java.io.File;
 import java.net.URL;
 import java.net.URLDecoder;
 
-import org.slf4j.Marker;
-
-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.spi.LoggingEvent;
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.joran.spi.JoranException;
 import ch.qos.logback.core.spi.FilterReply;
@@ -94,8 +91,7 @@ public class ReconfigureOnChangeFilter extends TurboFilter {
   private int invocationCounter = 0;
 
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     if (!isStarted()) {
       return FilterReply.NEUTRAL;
     }
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
index 4e6757c..2d6258c 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
@@ -13,10 +13,7 @@
  */
 package ch.qos.logback.classic.turbo;
 
-import org.slf4j.Marker;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.ContextAwareBase;
 import ch.qos.logback.core.spi.FilterReply;
 import ch.qos.logback.core.spi.LifeCycle;
@@ -50,8 +47,7 @@ public abstract class TurboFilter extends ContextAwareBase implements LifeCycle
    * @param t
    * @return
    */
-  public abstract FilterReply decide(Marker marker, Logger logger,
-      Level level, String format, Object[] params, Throwable t);
+  public abstract FilterReply decide(LoggingEvent event);
 
   public void start() {
     this.start = true;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
index c6723de..82d0b4e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
@@ -32,8 +32,8 @@ public class LoggerPerfTest {
   static long NORMAL_RUN_LENGTH = 1 * 1000 * 1000;
   static long SHORTENED_RUN_LENGTH = 500 * 1000;
 
-  LoggerContext lc = new LoggerContext();
-  Logger lbLogger = lc.getLogger(this.getClass());
+  LoggerContext context = new LoggerContext();
+  Logger lbLogger = context.getLogger(this.getClass());
   org.slf4j.Logger logger = lbLogger;
 
   @Before
@@ -46,15 +46,15 @@ public class LoggerPerfTest {
     double avg = computeDurationOfDisabledLogsWith_1_NOPFilter(1,
         NORMAL_RUN_LENGTH);
     System.out.println("durationOfDisabledLogsWith_1_NOPFilter=" + avg);
-    long referencePerf = 60;
-
+    
+    long referencePerf = 60+150;  // 150 for LoggingEvent creation and gc
     BogoPerf.assertDuration(avg, referencePerf, CoreConstants.REFERENCE_BIPS);
   }
 
   double computeDurationOfDisabledLogsWith_1_NOPFilter(int numOfFilters,
       long len) {
     for (int i = 0; i < numOfFilters; i++) {
-      lc.addTurboFilter(new NOPTurboFilter());
+      context.addTurboFilter(new NOPTurboFilter());
     }
     lbLogger.setLevel(Level.OFF);
     for (long i = 0; i < len; i++)
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
index 1bb51d6..a3e40cc 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
@@ -23,6 +23,7 @@ import org.junit.Test;
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
 
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.classic.turbo.MarkerFilter;
 import ch.qos.logback.classic.turbo.TurboFilter;
 import ch.qos.logback.core.spi.FilterReply;
@@ -168,16 +169,14 @@ public class TurboFilteringInLoggerTest  {
 
 class YesFilter extends TurboFilter {
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     return FilterReply.ACCEPT;
   }
 }
 
 class NoFilter extends TurboFilter {
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     return FilterReply.DENY;
   }
 }
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
index e9d6a07..ed0fe07 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
@@ -62,6 +62,7 @@ public class JaninoEventEvaluatorTest {
     LoggingEvent e = new LoggingEvent(
         ch.qos.logback.core.pattern.FormattingConverter.class.getName(),
         logger, Level.INFO, "Some message", ex, null);
+    e.secondaryInit();
     return e;
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
index 5611786..2a46f8d 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
@@ -48,9 +48,11 @@ public class ConverterTest {
   // forces the returned caller information to match the caller stack for this
   // this particular test.
   LoggingEvent makeLoggingEvent(Exception ex) {
-    return new LoggingEvent(
+    LoggingEvent le =  new LoggingEvent(
         ch.qos.logback.core.pattern.FormattingConverter.class.getName(),
         logger, Level.INFO, "Some message", ex, null);
+    le.secondaryInit();
+    return le;
   }
 
   Exception getException(String msg, Exception cause) {
@@ -74,7 +76,7 @@ public class ConverterTest {
       StringBuffer buf = new StringBuffer();
       converter.write(buf, le);
       // the number below should be the line number of the previous line
-      assertEquals("75", buf.toString());
+      assertEquals("77", buf.toString());
     }
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
index 4dcf089..816fa69 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
@@ -70,9 +70,10 @@ public class MDCConverterTest {
   }
 
   private ILoggingEvent createLoggingEvent() {
-    ILoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
+    LoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
         .getLogger(Logger.ROOT_LOGGER_NAME), Level.DEBUG, "test message", null,
         null);
+    le.secondaryInit();
     return le;
   }
 }
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
index 1caccf8..66977bb 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
@@ -186,6 +186,7 @@ public class LoggingEventSerializationTest {
   private LoggingEvent createLoggingEvent() {
     LoggingEvent le = new LoggingEvent(this.getClass().getName(), logger,
         Level.DEBUG, "test message", null, null);
+    le.secondaryInit();
     return le;
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
index f79cdf0..740a8f8 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
@@ -17,11 +17,10 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.slf4j.MDC;
-import org.slf4j.Marker;
 
 import ch.qos.logback.classic.ClassicConstants;
 import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 /**
@@ -40,8 +39,8 @@ public class DebugUsersTurboFilter extends TurboFilter {
   List<String> userList = new ArrayList<String>(); 
   
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) {
-    if (!level.equals(Level.DEBUG)) {
+  public FilterReply decide(LoggingEvent event) {
+    if (!event.getLevel().equals(Level.DEBUG)) {
       return FilterReply.NEUTRAL;
     } 
     String user = MDC.get(ClassicConstants.USER_MDC_KEY);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
index 5daddf3..627d7bf 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
@@ -13,27 +13,31 @@
  */
 package ch.qos.logback.classic.turbo;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
 
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 public class DuplicateMessageFilterTest {
 
+  LoggerContext context = new LoggerContext();
+  Logger logger = context.getLogger(this.getClass());
+  
   @Test
   public void smoke() {
     DuplicateMessageFilter dmf = new DuplicateMessageFilter();
     dmf.setAllowedRepetitions(0);
     dmf.start();
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "x", null,
-        null));
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "y", null,
-        null));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("x")));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("y")));
     assertEquals(FilterReply.DENY, dmf
-        .decide(null, null, null, "x", null, null));
+        .decide(newEvent("x")));
     assertEquals(FilterReply.DENY, dmf
-        .decide(null, null, null, "y", null, null));
+        .decide(newEvent("y")));
   }
 
   @Test
@@ -42,12 +46,9 @@ public class DuplicateMessageFilterTest {
     dmf.setAllowedRepetitions(1);
     dmf.setCacheSize(1);
     dmf.start();
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "a", null,
-        null));
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "b", null,
-        null));
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "a", null,
-        null));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("a")));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("b")));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("a")));
   }
 
   @Test
@@ -59,16 +60,13 @@ public class DuplicateMessageFilterTest {
     dmf.setCacheSize(cacheSize);
     dmf.start();
     for (int i = 0; i < cacheSize + margin; i++) {
-      assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "a" + i,
-          null, null));
+      assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("a" + i)));
     }
     for (int i = cacheSize - 1; i >= margin; i--) {
-      assertEquals(FilterReply.DENY, dmf.decide(null, null, null, "a" + i,
-          null, null));
+      assertEquals(FilterReply.DENY, dmf.decide(newEvent("a" + i)));
     }
     for (int i = margin - 1; i >= 0; i--) {
-      assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, "a" + i,
-          null, null));
+      assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent("a" + i)));
     }
   }
 
@@ -80,10 +78,12 @@ public class DuplicateMessageFilterTest {
     dmf.setAllowedRepetitions(0);
     dmf.setCacheSize(10);
     dmf.start();
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, null, null,
-        null));
-    assertEquals(FilterReply.NEUTRAL, dmf.decide(null, null, null, null, null,
-        null));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent(null)));
+    assertEquals(FilterReply.NEUTRAL, dmf.decide(newEvent(null)));
+  }
+
+  LoggingEvent newEvent(String m) {
+    return new LoggingEvent(null, logger, null, m, null, null);
   }
 
 }
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
index 33805dc..1846d0b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
@@ -21,6 +21,9 @@ import org.junit.Test;
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
 
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 public class MarkerFilterTest {
@@ -28,15 +31,16 @@ public class MarkerFilterTest {
   static String MARKER_NAME = "toto";
   
   Marker totoMarker = MarkerFactory.getMarker(MARKER_NAME);
-  
+  LoggerContext context = new LoggerContext();
+  Logger logger = context.getLogger(this.getClass());
 
   @Test
   public void testNoMarker() {
     MarkerFilter mkt = new MarkerFilter();
     mkt.start();
     assertFalse(mkt.isStarted());
-    assertEquals(FilterReply.NEUTRAL, mkt.decide(totoMarker, null, null, null, null, null));
-    assertEquals(FilterReply.NEUTRAL, mkt.decide(null, null, null, null, null, null));
+    assertEquals(FilterReply.NEUTRAL, mkt.decide(newEvent(totoMarker)));
+    assertEquals(FilterReply.NEUTRAL, mkt.decide(newEvent(null)));
 
   }
 
@@ -50,8 +54,15 @@ public class MarkerFilterTest {
 
     mkt.start();
     assertTrue(mkt.isStarted());
-    assertEquals(FilterReply.DENY, mkt.decide(null, null, null, null, null, null));
-    assertEquals(FilterReply.ACCEPT, mkt.decide(totoMarker, null, null, null, null, null));
+    assertEquals(FilterReply.DENY, mkt.decide(newEvent(null)));
+    assertEquals(FilterReply.ACCEPT, mkt.decide(newEvent(totoMarker)));
+  }
+  
+  LoggingEvent newEvent(Marker marker) {
+    LoggingEvent event =  new LoggingEvent(null, logger, null, null, null, null);
+    event.setMarker(marker);
+    return event;
   }
+
   
 }
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
index 94528b7..9cf43f4 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
@@ -13,18 +13,13 @@
  */
 package ch.qos.logback.classic.turbo;
 
-import org.slf4j.Marker;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.spi.FilterReply;
 
 public class NOPTurboFilter extends TurboFilter {
 
   @Override
-  public FilterReply decide(final Marker marker, final Logger logger, final Level level, final String format,
-      final Object[] params, final Throwable t) {
-   
+  public FilterReply decide(LoggingEvent event) {
     return FilterReply.NEUTRAL;
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
index ac2d714..4b462e7 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
@@ -24,6 +24,7 @@ import java.net.URL;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Marker;
 import org.slf4j.helpers.BogoPerf;
 
 import ch.qos.logback.classic.ClassicTestConstants;
@@ -32,6 +33,7 @@ import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.issue.lbclassic135.LoggingRunnable;
 import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.contention.MultiThreadedHarness;
 import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
@@ -66,6 +68,12 @@ public class ReconfigureOnChangeTest {
   Logger logger = loggerContext.getLogger(this.getClass());
   MultiThreadedHarness harness;
 
+  
+  LoggingEvent newEvent(Marker marker) {
+    LoggingEvent event =  new LoggingEvent(null, logger, null, null, null, null);
+    event.setMarker(marker);
+    return event;
+  }
   @Before
   public void setUp() {
     System.out.println("======== TEST START");
@@ -192,10 +200,17 @@ public class ReconfigureOnChangeTest {
     BogoPerf.assertDuration(avg, referencePerf, CoreConstants.REFERENCE_BIPS);
   }
 
+  LoggingEvent newEvent(Level level, String msg) {
+    LoggingEvent event =  new LoggingEvent(null, logger, level, msg, null, null);
+    return event;
+  }
+
   public double directLoop(ReconfigureOnChangeFilter rocf) {
+    LoggingEvent event = newEvent(Level.DEBUG, " ");
+    
     long start = System.nanoTime();
     for (int i = 0; i < LOOP_LEN; i++) {
-      rocf.decide(null, logger, Level.DEBUG, " ", null, null);
+      rocf.decide(event);
     }
     long end = System.nanoTime();
     return (end - start) / (1.0d * LOOP_LEN);
@@ -219,7 +234,7 @@ public class ReconfigureOnChangeTest {
     double avg = indirectLoop();
     System.out.println(avg);
     // the reference was computed on Orion (Ceki's computer)
-    long referencePerf = 68;
+    long referencePerf = 68+150; // extra 150 for LoggingEvent creation and gc
     BogoPerf.assertDuration(avg, referencePerf, CoreConstants.REFERENCE_BIPS);
   }
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
index 16a36c0..2fdba85 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
@@ -26,6 +26,7 @@ import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.issue.lbclassic135.LoggingRunnable;
 import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.contention.MultiThreadedHarness;
 import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
@@ -109,11 +110,15 @@ public class ReconfigurePerf {
     return rocf;
   }
 
-
+  LoggingEvent newEvent(Level level, String msg) {
+    LoggingEvent event =  new LoggingEvent(null, logger, level, msg, null, null);
+    return event;
+  }
+  
   public double directLoop(ReconfigureOnChangeFilter rocf) {
     long start = System.nanoTime();
     for (int i = 0; i < LOOP_LEN; i++) {
-      rocf.decide(null, logger, Level.DEBUG, " ", null, null);
+      rocf.decide(newEvent(Level.DEBUG, " "));
     }
     long end = System.nanoTime();
     return (end - start) / (1.0d * LOOP_LEN);
diff --git a/logback-examples/src/main/java/chapters/filters/SampleTurboFilter.java b/logback-examples/src/main/java/chapters/filters/SampleTurboFilter.java
index c75ce45..dfc4297 100644
--- a/logback-examples/src/main/java/chapters/filters/SampleTurboFilter.java
+++ b/logback-examples/src/main/java/chapters/filters/SampleTurboFilter.java
@@ -16,8 +16,7 @@ package chapters.filters;
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
 
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.classic.turbo.TurboFilter;
 import ch.qos.logback.core.spi.FilterReply;
 
@@ -27,8 +26,7 @@ public class SampleTurboFilter extends TurboFilter {
   Marker markerToAccept;
 
   @Override
-  public FilterReply decide(Marker marker, Logger logger, Level level,
-      String format, Object[] params, Throwable t) {
+  public FilterReply decide(LoggingEvent event) {
     
     if (!isStarted()) {
       return FilterReply.NEUTRAL;

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


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


More information about the logback-dev mailing list