You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2012/11/19 04:42:22 UTC

svn commit: r1411054 - in /logging/log4j/log4j2/trunk/src: changes/changes.xml site/xdoc/manual/filters.xml

Author: rgoers
Date: Mon Nov 19 03:42:21 2012
New Revision: 1411054

URL: http://svn.apache.org/viewvc?rev=1411054&view=rev
Log:
LOG4J2-123 - The example for ThreadContextMapFilter was incorrect.

Modified:
    logging/log4j/log4j2/trunk/src/changes/changes.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/filters.xml

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1411054&r1=1411053&r2=1411054&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Mon Nov 19 03:42:21 2012
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.0-beta4" date="TBD" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-123" dev="rgoers" type="fix" due-to="Olivier Lamy">
+        The example for ThreadContextMapFilter was incorrect.
+      </action>
       <action issue="LOG4J2-116" dev="rgoers" type="fix">
         File renaming was using the wrong date value. Enhanced DefaultRolloverStrategy to store newest files in
         highest index as well as lowest.

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/filters.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/filters.xml?rev=1411054&r1=1411053&r2=1411054&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/filters.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/filters.xml Mon Nov 19 03:42:21 2012
@@ -571,10 +571,10 @@
 
             <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <configuration status="warn" name="MyApp" packages="">
-  <DynamicThresholdFilter key="loginId" defaultThreshold="ERROR"
-                          onMatch="ACCEPT" onMismatch="NEUTRAL">
+  <ThreadContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
     <KeyValuePair key="User1" value="DEBUG"/>
-  </DynamicThresholdFilter>
+    <KeyValuePair key="User2" value="WARN"/>
+  </ThreadContextMapFilter>
   <appenders>
     <RollingFile name="RollingFile" fileName="logs/app.log"
                  filePattern="logs/app-%d{MM-dd-yyyy}.log.gz">
@@ -592,6 +592,32 @@
   </loggers>
 </configuration>]]></pre>
           </p>
+          <p>
+            The ThreadContextMapFilter can also be applied to a logger for filtering:
+            <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="warn" name="MyApp" packages="">
+  <appenders>
+    <RollingFile name="RollingFile" fileName="logs/app.log"
+                 filePattern="logs/app-%d{MM-dd-yyyy}.log.gz">
+      <BurstFilter level="INFO" rate="16" maxBurst="100"/>
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+      <TimeBasedTriggeringPolicy />
+    </RollingFile>
+  </appenders>
+  <loggers>
+    <root level="error">
+      <appender-ref ref="RollingFile"/>
+      <ThreadContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
+        <KeyValuePair key="foo" value="bar"/>
+        <KeyValuePair key="User2" value="WARN"/>
+      </ThreadContextMapFilter>
+    </root>
+  </loggers>
+</configuration>
+  ]]></source>
+          </p>
         </subsection>
         <a name="ThresholdFilter"/>
         <subsection name="ThresholdFilter">