[logback-dev] svn commit: r2092 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/joran logback-classic/src/main/java/ch/qos/logback/classic/sift logback-classic/src/main/java/ch/qos/logback/classic/turbo logback-classic/src/test/input/joran/sift logback-classic/src/test/java/ch/qos/logback/classic/turbo logback-core/src/main/java/ch/qos/logback/core/sift logback-examples/src/main/java/chapter6 logback-site/src/site/pages logback-site/src/site/pages/manual
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Fri Dec 19 17:10:56 CET 2008
Author: ceki
Date: Fri Dec 19 17:10:55 2008
New Revision: 2092
Added:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java
- copied, changed from r2091, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java
- copied, changed from r2087, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java
logback/trunk/logback-examples/src/main/java/chapter6/duplicateMessage.xml
Removed:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java
Modified:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
logback/trunk/logback-classic/src/test/input/joran/sift/completeCycle.xml
logback/trunk/logback-classic/src/test/input/joran/sift/hoard0.xml
logback/trunk/logback-classic/src/test/input/joran/sift/smoke.xml
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java
logback/trunk/logback-examples/src/main/java/chapter6/basicConfiguration.xml
logback/trunk/logback-examples/src/main/java/chapter6/basicEventEvaluator.xml
logback/trunk/logback-examples/src/main/java/chapter6/levelFilterConfig.xml
logback/trunk/logback-examples/src/main/java/chapter6/sampleTurboFilterConfig.xml
logback/trunk/logback-examples/src/main/java/chapter6/thresholdFilterConfig.xml
logback/trunk/logback-examples/src/main/java/chapter6/turboFilters.xml
logback/trunk/logback-site/src/site/pages/manual/filters.html
logback/trunk/logback-site/src/site/pages/manual/joran.html
logback/trunk/logback-site/src/site/pages/news.html
logback/trunk/logback-site/src/site/pages/support.html
Log:
- Documentation on DuplicateMessageFilter
- Finished renaming HoardingAppender as SiftingAppender (as well as associated classes)
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java Fri Dec 19 17:10:55 2008
@@ -20,7 +20,7 @@
import ch.qos.logback.classic.joran.action.LevelAction;
import ch.qos.logback.classic.joran.action.LoggerAction;
import ch.qos.logback.classic.joran.action.RootLoggerAction;
-import ch.qos.logback.classic.sift.HoardAction;
+import ch.qos.logback.classic.sift.SiftAction;
import ch.qos.logback.classic.spi.PlatformInfo;
import ch.qos.logback.core.joran.JoranConfiguratorBase;
import ch.qos.logback.core.joran.action.AppenderRefAction;
@@ -53,8 +53,8 @@
rs.addRule(new Pattern("*/evaluator/matcher"),
new MatcherAction());
- rs.addRule(new Pattern("configuration/appender/hoard"), new HoardAction());
- rs.addRule(new Pattern("configuration/appender/hoard/*"), new NOPAction());
+ rs.addRule(new Pattern("configuration/appender/sift"), new SiftAction());
+ rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction());
rs.addRule(new Pattern("configuration/logger"), new LoggerAction());
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java Fri Dec 19 17:10:55 2008
@@ -27,7 +27,7 @@
}
public SiftingJoranConfiguratorBase<LoggingEvent> getSiftingJoranConfigurator(String k) {
- return new HoardingJoranConfigurator(mdcKey, k);
+ return new SiftingJoranConfigurator(mdcKey, k);
}
}
Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java (from r2091, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardAction.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java Fri Dec 19 17:10:55 2008
@@ -11,7 +11,7 @@
import ch.qos.logback.core.joran.spi.ActionException;
import ch.qos.logback.core.joran.spi.InterpretationContext;
-public class HoardAction extends Action implements InPlayListener {
+public class SiftAction extends Action implements InPlayListener {
List<SaxEvent> seList;
@Override
Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java (from r2087, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/HoardingJoranConfigurator.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java Fri Dec 19 17:10:55 2008
@@ -12,12 +12,12 @@
import ch.qos.logback.core.joran.spi.RuleStore;
import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
-public class HoardingJoranConfigurator extends SiftingJoranConfiguratorBase<LoggingEvent> {
+public class SiftingJoranConfigurator extends SiftingJoranConfiguratorBase<LoggingEvent> {
String key;
String value;
- HoardingJoranConfigurator(String key, String value) {
+ SiftingJoranConfigurator(String key, String value) {
this.key = key;
this.value = value;
}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java Fri Dec 19 17:10:55 2008
@@ -15,22 +15,36 @@
import ch.qos.logback.classic.Logger;
import ch.qos.logback.core.spi.FilterReply;
+/**
+ *
+ * See {@link http://logback.qos.ch/manual/filters.html#DuplicateMessageFilter}
+ * for details.
+ *
+ * @author Ceki Gulcu
+ *
+ */
public class DuplicateMessageFilter extends TurboFilter {
- static final int DEFAULT_CACHE_SIZE = 100;
- static final int DEFAULT_ALLOWED_REPETITIONS = 5;
-
+ /**
+ * The default cache size.
+ */
+ public static final int DEFAULT_CACHE_SIZE = 100;
+ /**
+ * The default number of allows repetitions.
+ */
+ public static final int DEFAULT_ALLOWED_REPETITIONS = 5;
+
public int allowedRepetitions = DEFAULT_ALLOWED_REPETITIONS;
public int cacheSize = DEFAULT_CACHE_SIZE;
-
+
private LRUMessageCache msgCache;
-
+
@Override
public void start() {
msgCache = new LRUMessageCache(cacheSize);
super.start();
}
-
+
@Override
public void stop() {
msgCache.clear();
@@ -42,7 +56,7 @@
public FilterReply decide(Marker marker, Logger logger, Level level,
String format, Object[] params, Throwable t) {
int count = msgCache.getMessageCount(format);
- if(count <= allowedRepetitions) {
+ if (count <= allowedRepetitions) {
return FilterReply.NEUTRAL;
} else {
return FilterReply.DENY;
@@ -53,6 +67,11 @@
return allowedRepetitions;
}
+ /**
+ * The allowed number of repetitions before
+ *
+ * @param allowedRepetitions
+ */
public void setAllowedRepetitions(int allowedRepetitions) {
this.allowedRepetitions = allowedRepetitions;
}
@@ -64,5 +83,5 @@
public void setCacheSize(int cacheSize) {
this.cacheSize = cacheSize;
}
-
+
}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java Fri Dec 19 17:10:55 2008
@@ -29,7 +29,7 @@
int getMessageCount(String msg) {
Integer i = super.get(msg);
if(i == null) {
- i = 1;
+ i = 0;
} else {
i = new Integer(i.intValue()+1);
}
Modified: logback/trunk/logback-classic/src/test/input/joran/sift/completeCycle.xml
==============================================================================
--- logback/trunk/logback-classic/src/test/input/joran/sift/completeCycle.xml (original)
+++ logback/trunk/logback-classic/src/test/input/joran/sift/completeCycle.xml Fri Dec 19 17:10:55 2008
@@ -8,9 +8,9 @@
<mdcKey>cycle</mdcKey>
<defaultValue>cycleDefault</defaultValue>
- <hoard>
+ <sift>
<appender name="list-${cycle}" class="ch.qos.logback.core.read.ListAppender"/>
- </hoard>
+ </sift>
</appender>
<root level="DEBUG">
Modified: logback/trunk/logback-classic/src/test/input/joran/sift/hoard0.xml
==============================================================================
--- logback/trunk/logback-classic/src/test/input/joran/sift/hoard0.xml (original)
+++ logback/trunk/logback-classic/src/test/input/joran/sift/hoard0.xml Fri Dec 19 17:10:55 2008
@@ -4,11 +4,11 @@
<configuration debug="true">
<appender name="SIFT"
- class="ch.qos.logback.classic.hoard.HoardingAppender">
+ class="ch.qos.logback.classic.sift.SiftingAppender">
<mdcKey>userid</mdcKey>
<default>asdad</default>
- <hoard>
+ <sift>
<appender name="FILE-${userid}" class="ch.qos.logback.core.FileAppender">
<File>${userid}.log</File>
<Append>true</Append>
@@ -16,7 +16,7 @@
<Pattern>%d [%thread] %level %logger{35} - %msg%n</Pattern>
</layout>
</appender>
- </hoard>
+ </sift>
</appender>
<root level="DEBUG">
Modified: logback/trunk/logback-classic/src/test/input/joran/sift/smoke.xml
==============================================================================
--- logback/trunk/logback-classic/src/test/input/joran/sift/smoke.xml (original)
+++ logback/trunk/logback-classic/src/test/input/joran/sift/smoke.xml Fri Dec 19 17:10:55 2008
@@ -8,9 +8,9 @@
<mdcKey>userid</mdcKey>
<defaultValue>smoke</defaultValue>
- <hoard>
+ <sift>
<appender name="list-${userid}" class="ch.qos.logback.core.read.ListAppender"/>
- </hoard>
+ </sift>
</appender>
<root level="DEBUG">
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java Fri Dec 19 17:10:55 2008
@@ -1,3 +1,12 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ *
+ * Copyright (C) 2000-2008, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
package ch.qos.logback.classic.turbo;
import static org.junit.Assert.*;
@@ -13,7 +22,7 @@
@Test
public void smoke() {
DuplicateMessageFilter dmf = new DuplicateMessageFilter();
- dmf.setAllowedRepetitions(1);
+ 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));
@@ -36,7 +45,7 @@
@Test
public void many() {
DuplicateMessageFilter dmf = new DuplicateMessageFilter();
- dmf.setAllowedRepetitions(1);
+ dmf.setAllowedRepetitions(0);
int cacheSize = 10;
int margin = 2;
dmf.setCacheSize(cacheSize);
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java Fri Dec 19 17:10:55 2008
@@ -28,12 +28,6 @@
UnsynchronizedAppenderBase<E> {
protected AppenderTracker<E, K> appenderTracker = new AppenderTrackerImpl<E, K>();
- // Map<String, Appender<LoggingEvent>> appenderMap = new Hashtable<String,
- // Appender<LoggingEvent>>();
-
- String mdcKey;
- String defaultValue;
-
AppenderFactoryBase<E, K> appenderFactory;
public void setAppenderFactory(AppenderFactoryBase<E, K> appenderFactory) {
@@ -53,7 +47,6 @@
}
abstract protected K getDiscriminatingValue(E event);
-
abstract protected long getTimestamp(E event);
@Override
@@ -82,20 +75,4 @@
appender.doAppend(event);
}
- public String getMdcKey() {
- return mdcKey;
- }
-
- public void setMdcKey(String mdcKey) {
- this.mdcKey = mdcKey;
- }
-
- /**
- * @see #setDefaultValue(String)
- * @return
- */
- public String getDefaultValue() {
- return defaultValue;
- }
-
}
Modified: logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java Fri Dec 19 17:10:55 2008
@@ -33,13 +33,13 @@
for (int i = 0; i < 10; i++) {
if (i == 3) {
MDC.put("username", "sebastien");
- logger.debug("logging statement " + i);
+ logger.debug("logging statement {}", i);
MDC.remove("username");
} else if (i == 6) {
Marker billing = MarkerFactory.getMarker("billing");
- logger.error(billing, "billing statement " + i);
+ logger.error(billing, "billing statement {}", i);
} else {
- logger.info("logging statement " + i);
+ logger.info("logging statement {}", i);
}
}
}
Modified: logback/trunk/logback-examples/src/main/java/chapter6/basicConfiguration.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/basicConfiguration.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/basicConfiguration.xml Fri Dec 19 17:10:55 2008
@@ -1,16 +1,12 @@
<configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %-4relative [%thread] %-5level %logger - %msg%n
- </pattern>
- </layout>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger - %msg%n</pattern>
+ </layout>
+ </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="STDOUT" />
- </root>
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter6/basicEventEvaluator.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/basicEventEvaluator.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/basicEventEvaluator.xml Fri Dec 19 17:10:55 2008
@@ -1,23 +1,19 @@
<configuration debug="true">
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator name="myEval">
- <expression>message.contains("billing")</expression>
- </evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>DENY</OnMatch>
- </filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %-4relative [%thread] %-5level %logger - %msg%n
- </pattern>
- </layout>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="myEval">
+ <expression>message.contains("billing")</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>DENY</OnMatch>
+ </filter>
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger - %msg%n</pattern>
+ </layout>
+ </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="STDOUT" />
- </root>
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
</configuration>
\ No newline at end of file
Added: logback/trunk/logback-examples/src/main/java/chapter6/duplicateMessage.xml
==============================================================================
--- (empty file)
+++ logback/trunk/logback-examples/src/main/java/chapter6/duplicateMessage.xml Fri Dec 19 17:10:55 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<configuration>
+
+ <turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter" />
+
+ <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>%date [%thread] %-5level %logger - %msg%n</Pattern>
+ </layout>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="console" />
+ </root>
+</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter6/levelFilterConfig.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/levelFilterConfig.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/levelFilterConfig.xml Fri Dec 19 17:10:55 2008
@@ -1,21 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
- <appender name="CONSOLE"
- class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>INFO</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %-4relative [%thread] %-5level %logger{30} - %msg%n
- </pattern>
- </layout>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="CONSOLE" />
- </root>
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>INFO</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger{30} - %msg%n</pattern>
+ </layout>
+ </appender>
+ <root level="DEBUG">
+ <appender-ref ref="CONSOLE" />
+ </root>
</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter6/sampleTurboFilterConfig.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/sampleTurboFilterConfig.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/sampleTurboFilterConfig.xml Fri Dec 19 17:10:55 2008
@@ -1,19 +1,16 @@
<configuration>
- <turboFilter class="chapter6.SampleTurboFilter">
- <Marker>sample</Marker>
- </turboFilter>
+ <turboFilter class="chapter6.SampleTurboFilter">
+ <Marker>sample</Marker>
+ </turboFilter>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %-4relative [%thread] %-5level %logger - %msg%n
- </pattern>
- </layout>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger - %msg%n</pattern>
+ </layout>
+ </appender>
- <root>
- <appender-ref ref="STDOUT" />
- </root>
+ <root>
+ <appender-ref ref="STDOUT" />
+ </root>
</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter6/thresholdFilterConfig.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/thresholdFilterConfig.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/thresholdFilterConfig.xml Fri Dec 19 17:10:55 2008
@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
- <appender name="CONSOLE"
- class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %-4relative [%thread] %-5level %logger{30} - %msg%n
- </pattern>
- </layout>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="CONSOLE" />
- </root>
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger{30} - %msg%n</pattern>
+ </layout>
+ </appender>
+ <root level="DEBUG">
+ <appender-ref ref="CONSOLE" />
+ </root>
</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter6/turboFilters.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/turboFilters.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/turboFilters.xml Fri Dec 19 17:10:55 2008
@@ -2,16 +2,16 @@
<configuration>
- <turboFilter class="ch.qos.logback.classic.turbo.MDCFilter">
- <MDCKey>username</MDCKey>
- <Value>sebastien</Value>
- <OnMatch>ACCEPT</OnMatch>
- </turboFilter>
-
- <turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
- <Marker>billing</Marker>
- <OnMatch>DENY</OnMatch>
- </turboFilter>
+ <turboFilter class="ch.qos.logback.classic.turbo.MDCFilter">
+ <MDCKey>username</MDCKey>
+ <Value>sebastien</Value>
+ <OnMatch>ACCEPT</OnMatch>
+ </turboFilter>
+
+ <turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
+ <Marker>billing</Marker>
+ <OnMatch>DENY</OnMatch>
+ </turboFilter>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
@@ -19,8 +19,7 @@
</layout>
</appender>
- <root>
- <level value="info"/>
+ <root level="info">
<appender-ref ref="console" />
- </root>
+ </root>
</configuration>
\ No newline at end of file
Modified: logback/trunk/logback-site/src/site/pages/manual/filters.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/filters.html (original)
+++ logback/trunk/logback-site/src/site/pages/manual/filters.html Fri Dec 19 17:10:55 2008
@@ -390,7 +390,7 @@
<p>The <a
href="../xref/chapter6/FilterEvents.html"><code>FilterEvents</code></a>
- class issues ten logging requests, numbered from 0 to 9. Let us
+ application issues ten logging requests, numbered 0 to 9. Let us
rist run <code>FilterEvents</code> class without any filters:
</p>
@@ -422,7 +422,7 @@
<p>we obtain:
</p>
-<div class="source"><pre>0 [main] INFO chapter6.FilterEvents - logging statement 0
+ <p class="source">0 [main] INFO chapter6.FilterEvents - logging statement 0
0 [main] INFO chapter6.FilterEvents - logging statement 1
0 [main] INFO chapter6.FilterEvents - logging statement 2
0 [main] DEBUG chapter6.FilterEvents - logging statement 3
@@ -430,11 +430,10 @@
0 [main] INFO chapter6.FilterEvents - logging statement 5
0 [main] INFO chapter6.FilterEvents - logging statement 7
0 [main] INFO chapter6.FilterEvents - logging statement 8
-0 [main] INFO chapter6.FilterEvents - logging statement 9</pre></div>
+0 [main] INFO chapter6.FilterEvents - logging statement 9</p>
- <a name="TurboFilter"></a>
- <h3>TurboFilters</h3>
+ <h2><a name="TurboFilter" href="#TurboFilter">TurboFilters</a></h2>
<p><code>TurboFilter</code> objects all extend the
<a href="../xref/ch/qos/logback/classic/turbo/TurboFilter.html">
@@ -601,31 +600,32 @@
</root>
</configuration></pre></div>
- <p>
- You can see this configuration in action by issuing the following command:
+ <p>You can see this configuration in action by issuing the
+ following command:
</p>
-<div class="source"><pre>
-java chapter6.FilterEvents src/main/java/chapter6/turboFilters.xml
-</pre></div>
+ <p class="source">java chapter6.FilterEvents src/main/java/chapter6/turboFilters.xml</p>
- <p>
- As we've seen previously, the <code>FilterEvents</code> class creates 10 logging requests,
- each with its number from 0 to 9. All of the requests are of level <em>INFO</em>,
- just like the configured overall level, except for two requests.
- The 3rd request, is a <em>DEBUG</em> level corresponding to the key <em>username</em>.
- This obviously satisfies the first <code>TurboFilter</code> declared in the previous
- configuration file. The 6th request, a <em>ERROR</em> level request,
- which is issued along with the <em>billing</em> marker, matches
- the second <code>TurboFilter</code>.
+ <p>As we've seen previously, the <a
+ href="../xref/chapter6/FilterEvents.html"><code>FilterEvents</code></a>
+ application issues 10 logging requests, numbered 0 to 9. Except
+ for requests 3 and 6, all of the requests are of level
+ <em>INFO</em>, the same level as the one assigned to the root
+ logger. The 3rd request, is issued at the the <em>DEBUG</em>
+ level, which is below the effective level. However, since the MDC
+ key "username" is set to "sebastien" just before the 3rd request
+ and removed just afterwards, the <code>MDCFilter</code>
+ specifically accepts the request (and only that request). The 6th
+ request, issued at the <em>ERROR</em> level, is marked as
+ "billing". As such, it is denied by the MarkerFilter (the second
+ turbo filter in the configuration).
</p>
- <p>
- Here is the output of the previous command:
+ <p>Thus, the output of <code>FilterEvents</code> application
+ configured with <em>turboFilters.xml</em> file shown above is:
</p>
-<div class="source"><pre>
-2006-12-04 15:17:22,859 [main] INFO chapter6.FilterEvents - logging statement 0
+ <p class="source">2006-12-04 15:17:22,859 [main] INFO chapter6.FilterEvents - logging statement 0
2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 1
2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 2
2006-12-04 15:17:22,875 [main] DEBUG chapter6.FilterEvents - logging statement 3
@@ -633,24 +633,119 @@
2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 5
2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 7
2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 8
-2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 9
-</pre></div>
+2006-12-04 15:17:22,875 [main] INFO chapter6.FilterEvents - logging statement 9</p>
- <p>
- One can see that the 3rd request, who should not be displayed if we
- only followed the overall <em>INFO</em> level, appears anyway, because
- it matched the first <code>TurboFilter</code> requirements and was accepted.
+ <p>One can see that the 3rd request, which should not be displayed
+ if we only followed the overall <em>INFO</em> level, appears
+ anyway, because it matched the first <code>TurboFilter</code>
+ requirements and was accepted.
</p>
- <p>
- On the other hand, the 6th request, that is a <em>ERROR</em> level request
- should have been displayed. But it satisfied the second <code>TurboFilter</code>
- whose <span class="option">OnMatch</span> option is set to <em>DENY</em>.
- Thus, the 6th request was not displayed.
+ <p>On the other hand, the 6th request, that is a <em>ERROR</em>
+ level request should have been displayed. But it satisfied the
+ second <code>TurboFilter</code> whose <span
+ class="option">OnMatch</span> option is set to <em>DENY</em>.
+ Thus, the 6th request was not displayed.
</p>
+
+
+ <h3><a name="DuplicateMessageFilter"
+ href="#DuplicateMessageFilter">DuplicateMessageFilter</a></h3>
+
+ <p>The <code>DuplicateMessageFilter</code> merits a separate
+ presentation. This filter detects duplicate messages, and beyond
+ a certain number of repetitions, drops repeated messages.
+ </p>
+
+ <p>To detect repetition, this filter uses simple String equality
+ between messages. It does not detect messages which are very
+ similar, varying only by few characters. For example, if you
+ write:
+ </p>
+
+ <p class="source">logger.debug("Hello "+name0);
+logger.debug("Hello "+name1);</p>
+
+ <p>Assuming <code>name0</code> and <code>name1</code> have
+ different values, the two "Hello" messages will be considered as
+ unrelated. Depending on user demand, future releases may check for
+ string similarity, eliminating repetitions of similar but not
+ identical messages.
+ </p>
+
+ <p>Note that in case of parameterized logging, only the raw
+ message is taken into consideration. For example, in the next two
+ requests, the raw messages, i.e. "Hello {}.", are identical, and
+ thus considered as repetitions.
+ </p>
+
+ <p class="source">logger.debug("Hello {}.", name0);
+logger.debug("Hello {}.", name1);</p>
+
+ <p>The number of allowed repetitions can be specified by the <span
+ class="option">AllowedRepetitions</span> property. For example, if
+ the said property is set to 1, then the 2nd and subsequent
+ occurrences of the same message will be dropped. Similarly, if the
+ said property is set to 2, then the 3rd and subsequent occurrences
+ of the same message will be dropped. By default, the <span
+ class="option">AllowedRepetitions</span> property is set to 5.
+ </p>
+
+ <p>In order to detect repetitions, this filter needs to keep
+ references to old messages in an internal cache. The size of this
+ cache is determined by the <span class="option">CacheSize</span>
+ property. By the default, this is set to 100.
+ </p>
+
+
+<em>Example: <code>DuplicateMessageFilter</code>
+configuration (logback-examples/src/main/java/chapter6/duplicateMessage.xml)</em>
+<div class="source"><pre><configuration>
+
+ <b><turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter"/></b>
+
+ <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>%date [%thread] %-5level %logger - %msg%n</Pattern>
+ </layout>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="console" />
+ </root>
+</configuration></pre></div>
+
+ <p>Thus, the output for <code>FilterEvents</code> application
+ configured with <em>duplicateMessage.xml</em> is:
+ </p>
+
+ <p class="source">2008-12-19 15:04:26,156 [main] INFO chapter6.FilterEvents - logging statement 0
+2008-12-19 15:04:26,156 [main] INFO chapter6.FilterEvents - logging statement 1
+2008-12-19 15:04:26,156 [main] INFO chapter6.FilterEvents - logging statement 2
+2008-12-19 15:04:26,156 [main] INFO chapter6.FilterEvents - logging statement 4
+2008-12-19 15:04:26,156 [main] INFO chapter6.FilterEvents - logging statement 5
+2008-12-19 15:04:26,171 [main] ERROR chapter6.FilterEvents - billing statement 6</p>
+
+ <p>"logging statement 0" is the first <em>occurrence</em> of the
+ message "logging statement {}". "logging statement 1" is the first
+ <em>repetition</em>, "logging statement 2" is the second
+ repetition. Interestingly enough, "logging statement 3" of level
+ DEBUG, is the <em>third</em> repetition, even though it is later
+ dropped by virtue of the <a
+ href="architecture.html#basic_selection">basic selection
+ rule</a>. This can be explained by the fact that turbo filters are
+ invoked before other types of filters, including the basic
+ selection rule. Thus, <code>DuplicateMessageFilter</code>
+ considers "logging statement 3" as a repetition, oblivious to the
+ fact that it will be dropped further down in the processing
+ chain. "logging statement 4" is the fourth repetition and "logging
+ statement 5" the fifth. Statements 6 and beyond are dropped
+ because only 5 repetitions are allowed by default.
+ </p>
+
<h2>Logback-access</h2>
<p>Logback-access offers most of the features available with
Modified: logback/trunk/logback-site/src/site/pages/manual/joran.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/joran.html (original)
+++ logback/trunk/logback-site/src/site/pages/manual/joran.html Fri Dec 19 17:10:55 2008
@@ -414,12 +414,21 @@
</p>
<p>Given a <code>StatusManager</code> you an access all the status
- data associated with a logback context. You may also attach a
- <code>StatusListener</code> to a <code>StatusManager</code> so that
- you can take immediate action in response to status messages,
- especially to messages occuring after logback
- configuration. Registering a status listener is a convenient way to
- supervise logback's internal state without human intervention.
+ data associated with a logback context. To keep memory usage at
+ reasonable levels, the default <code>StatusManager</code>
+ implementation stores the status messages in two separate parts,
+ the header part and the tail part. The header part stores the fist
+ <em>H</em> status messages whereas the tail part stores the last
+ <em>T</em> messages. At present time <em>H</em>=<em>T</em>=150,
+ although these values may change in future releases.</p>
+
+
+ <p>You may also attach a <code>StatusListener</code> to a
+ <code>StatusManager</code> so that you can take immediate action in
+ response to status messages, especially to messages occurring after
+ logback configuration. Registering a status listener is a
+ convenient way to supervise logback's internal state without human
+ intervention.
</p>
<p>Logback ships with a <code>StatusListener</code> implementation
Modified: logback/trunk/logback-site/src/site/pages/news.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/news.html (original)
+++ logback/trunk/logback-site/src/site/pages/news.html Fri Dec 19 17:10:55 2008
@@ -29,6 +29,37 @@
<hr width="80%" align="center" />
+ <h3>xx of December 2008 - Release of version 0.9.14</h3>
+
+ <p>Corrected a serious dead-lock problem occuring during
+ configuration. It was reported in <a
+ href="http://jira.qos.ch/browse/LBCLASSIC-81">LBCLASSIC-81</a> by
+ Holger Mense.</p>
+
+ <p>Corrected thread leakage observed with
+ <code>TimeBasedRollingPolicy</code>'s
+ <code>AsynchronousCompressor</code>. This bug was reported in <a
+ href="http://jira.qos.ch/browse/LBCORE-78">LBCORE-78</a> by Szel
+ Zoltan.</p>
+
+ <p>Added <a
+ href="manual/filters.html#DuplicateMessageFilter">DuplicateMessageFilter</a>,
+ a turbo filter which detects duplicate messages, and beyond a
+ certain number of repetitions, drops repeated messages.</p>
+
+
+ <p><code>BasicStatusManager</code>'s internal buffer is now split
+ into two parts, the header part and the tail part. The header part
+ stores the fist H status messages whereas the tail part stores the
+ last T messages. At present time H=T=150, although these values may
+ change in future releases.</p>
+
+ <p>Fixed <code>NullPointerException</code> thrown when calling
+ <code>setContextMap</code> on a fresh MDC. <a
+ href="http://jira.qos.ch/browse/LBCLASSIC-98">Issue was</a>
+ reported by Francois Terrier.
+ </p>
+
<h3>5th of December 2008 - Release of version 0.9.13</h3>
<p>A <code>NullPointerException</code> was being thrown when a the
Modified: logback/trunk/logback-site/src/site/pages/support.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/support.html (original)
+++ logback/trunk/logback-site/src/site/pages/support.html Fri Dec 19 17:10:55 2008
@@ -30,15 +30,17 @@
<p>As the founders and current maintainers of the logback project,
we can offer you highest quality of support. Opting for our
- professional logback support service is a great way to leverage the
- expertise of developers who have in depth knowledge of the logback
- framework.
+ professional logback support service is a great way to leverage
+ the expertise of logback developers.
</p>
+ <p>If your project requires custom appenders or logback
+ extensions, we can also help you.
+ </p>
- <p>To obtain a quote for "Professional Support Contract" please do
- not hesitate to contact us. We will happy to discuss or help you
- with logging-related issues.</p>
+ <p>For a quote for "Professional Support Contract" please do not
+ hesitate to contact us. We will happy to discuss or help you with
+ logging-related issues.</p>
<table>
<tr>
More information about the logback-dev
mailing list