You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/08/23 16:20:07 UTC
[01/10] logging-log4j2 git commit: [LOG4J2-1543] Remove deprecated
API Core org.apache.logging.log4j.core.util.Constants.UTF_8. Update
changes.xml.
Repository: logging-log4j2
Updated Branches:
refs/heads/LOG4J2-1349-gcfree-threadcontext efd21a755 -> 4d656debd
[LOG4J2-1543] Remove deprecated API Core
org.apache.logging.log4j.core.util.Constants.UTF_8. Update changes.xml.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/abe0a630
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/abe0a630
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/abe0a630
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: abe0a6308a00561b08f32e0c9491ff0f2f7a4e63
Parents: 6ad8fca
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 08:19:50 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 08:19:50 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/abe0a630/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f44d7ac..ad93231 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -132,6 +132,9 @@
<action issue="LOG4J2-1487" dev="ggregory" type="update" due-to="Gary Gregory">
Update JMS test from ActiveMQ 5.13.3 to 5.13.4.
</action>
+ <action issue="LOG4J2-1543" dev="ggregory" type="update" due-to="Gary Gregory">
+ Remove deprecated API Core org.apache.logging.log4j.core.util.Constants.UTF_8.
+ </action>
</release>
<release version="2.6.2" date="2016-07-05" description="GA Release 2.6.2">
<action issue="LOG4J2-904" dev="rgoers" type="fix" due-to="Bernhard M�hr">
[08/10] logging-log4j2 git commit: Merge remote-tracking branch
'remotes/origin/master' into
LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Posted by rp...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8b9e0e36
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8b9e0e36
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8b9e0e36
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 8b9e0e36fd1d43da92d7054fd8b6692ca38108b2
Parents: 9a09ccb e9a1bbe
Author: rpopma <rp...@apache.org>
Authored: Wed Aug 24 01:17:26 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Wed Aug 24 01:17:26 2016 +0900
----------------------------------------------------------------------
src/changes/changes.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
[04/10] logging-log4j2 git commit: [LOG4J2-1545] Remove deprecated
Web API org.apache.logging.log4j.web.WebLookup.getServletContext(). Update
changes.xml.
Posted by rp...@apache.org.
[LOG4J2-1545] Remove deprecated Web API
org.apache.logging.log4j.web.WebLookup.getServletContext(). Update
changes.xml.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/edb3a8c2
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/edb3a8c2
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/edb3a8c2
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: edb3a8c23f408582c71503000bb096d3c316418e
Parents: 2c85c5b
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 08:28:56 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 08:28:56 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/edb3a8c2/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fd19819..ef82246 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -138,6 +138,9 @@
<action issue="LOG4J2-1544" dev="ggregory" type="update" due-to="Gary Gregory">
Remove deprecated Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String).
</action>
+ <action issue="LOG4J2-1545" dev="ggregory" type="update" due-to="Gary Gregory">
+ Remove deprecated Web API org.apache.logging.log4j.web.WebLookup.getServletContext().
+ </action>
</release>
<release version="2.6.2" date="2016-07-05" description="GA Release 2.6.2">
<action issue="LOG4J2-904" dev="rgoers" type="fix" due-to="Bernhard M�hr">
[07/10] logging-log4j2 git commit: LOG4J2-1010 updated manual for
ThreadContextMapFilter aliasing to ContextMapFilter and potentially handling
other contexts than ThreadContext
Posted by rp...@apache.org.
LOG4J2-1010 updated manual for ThreadContextMapFilter aliasing to ContextMapFilter and potentially handling other contexts than ThreadContext
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9a09ccbd
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9a09ccbd
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9a09ccbd
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 9a09ccbd4e8432c0d486e4257c377a326baaf5aa
Parents: ca90bc1
Author: rpopma <rp...@apache.org>
Authored: Wed Aug 24 01:14:14 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Wed Aug 24 01:14:14 2016 +0900
----------------------------------------------------------------------
src/site/xdoc/manual/filters.xml | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9a09ccbd/src/site/xdoc/manual/filters.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/filters.xml b/src/site/xdoc/manual/filters.xml
index a53b3bf..bab5ae9 100644
--- a/src/site/xdoc/manual/filters.xml
+++ b/src/site/xdoc/manual/filters.xml
@@ -653,12 +653,13 @@
</Configuration>]]></pre>
</subsection>
<a name="ThreadContextMapFilter"/>
- <subsection name="ThreadContextMapFilter">
+ <subsection name="ThreadContextMapFilter (or ContextMapFilter)">
<p>
- The ThreadContextMapFilter allows filtering against data elements that are in the ThreadContext Map.
+ The ThreadContextMapFilter or ContextMapFilter allows filtering against data elements that are in the
+ current context. By default this is the ThreadContext Map.
</p>
<table>
- <caption align="top">ThreadContext Map Filter Parameters</caption>
+ <caption align="top">Context Map Filter Parameters</caption>
<tr>
<th>Parameter Name</th>
<th>Type</th>
@@ -690,14 +691,14 @@
</tr>
</table>
<p>
- A configuration containing the ThreadContextMapFilter might look like:
+ A configuration containing the ContextMapFilter might look like:
</p>
<pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="MyApp" packages="">
- <ThreadContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
+ <ContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
<KeyValuePair key="User1" value="DEBUG"/>
<KeyValuePair key="User2" value="WARN"/>
- </ThreadContextMapFilter>
+ </ContextMapFilter>
<Appenders>
<RollingFile name="RollingFile" fileName="logs/app.log"
filePattern="logs/app-%d{MM-dd-yyyy}.log.gz">
@@ -715,7 +716,7 @@
</Loggers>
</Configuration>]]></pre>
<p>
- The ThreadContextMapFilter can also be applied to a logger for filtering:
+ The ContextMapFilter can also be applied to a logger for filtering:
</p>
<pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="MyApp" packages="">
@@ -732,10 +733,10 @@
<Loggers>
<Root level="error">
<AppenderRef ref="RollingFile"/>
- <ThreadContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
+ <ContextMapFilter onMatch="ACCEPT" onMismatch="NEUTRAL" operator="or">
<KeyValuePair key="foo" value="bar"/>
<KeyValuePair key="User2" value="WARN"/>
- </ThreadContextMapFilter>
+ </ContextMapFilter>
</Root>
</Loggers>
</Configuration>
[03/10] logging-log4j2 git commit: [LOG4J2-1544] Remove deprecated
Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T,
String). Update changes.xml.
Posted by rp...@apache.org.
[LOG4J2-1544] Remove deprecated Core API
org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String).
Update changes.xml.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2c85c5bb
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2c85c5bb
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2c85c5bb
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 2c85c5bb299e4beda110b2cc94b89e2b07725cc4
Parents: ed056d7
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 08:25:21 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 08:25:21 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2c85c5bb/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a12926b..fd19819 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -135,6 +135,9 @@
<action issue="LOG4J2-1543" dev="ggregory" type="update" due-to="Gary Gregory">
Remove deprecated Core API org.apache.logging.log4j.core.util.Constants.UTF_8.
</action>
+ <action issue="LOG4J2-1544" dev="ggregory" type="update" due-to="Gary Gregory">
+ Remove deprecated Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String).
+ </action>
</release>
<release version="2.6.2" date="2016-07-05" description="GA Release 2.6.2">
<action issue="LOG4J2-904" dev="rgoers" type="fix" due-to="Bernhard M�hr">
[05/10] logging-log4j2 git commit: [LOG4J2-1546] Remove deprecated
Core API
org.apache.logging.log4j.core.config.LoggerConfig.createLogger(String, Level,
String, String , AppenderRef[] refs, Property[], Configuration config,
Filter). Update changes.xml.
Posted by rp...@apache.org.
[LOG4J2-1546] Remove deprecated Core API
org.apache.logging.log4j.core.config.LoggerConfig.createLogger(String,
Level, String, String , AppenderRef[] refs, Property[], Configuration
config, Filter). Update changes.xml.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e9a1bbe6
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e9a1bbe6
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e9a1bbe6
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: e9a1bbe6dd9e720b3bee6d798e40de0fc151d47a
Parents: edb3a8c
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 08:34:44 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 08:34:44 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e9a1bbe6/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ef82246..42d61d0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -141,6 +141,9 @@
<action issue="LOG4J2-1545" dev="ggregory" type="update" due-to="Gary Gregory">
Remove deprecated Web API org.apache.logging.log4j.web.WebLookup.getServletContext().
</action>
+ <action issue="LOG4J2-1546" dev="ggregory" type="update" due-to="Gary Gregory">
+ Remove deprecated Core API org.apache.logging.log4j.core.config.LoggerConfig.createLogger(String, Level, String, String , AppenderRef[] refs, Property[], Configuration config, Filter).
+ </action>
</release>
<release version="2.6.2" date="2016-07-05" description="GA Release 2.6.2">
<action issue="LOG4J2-904" dev="rgoers" type="fix" due-to="Bernhard M�hr">
[09/10] logging-log4j2 git commit: Merge branch
'LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure' into
LOG4J2-1349-gcfree-threadcontext
Posted by rp...@apache.org.
Merge branch 'LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure' into LOG4J2-1349-gcfree-threadcontext
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8d56062c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8d56062c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8d56062c
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 8d56062ceaf7c85c422898ca363775ac0f205256
Parents: efd21a7 8b9e0e3
Author: rpopma <rp...@apache.org>
Authored: Wed Aug 24 01:18:26 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Wed Aug 24 01:18:26 2016 +0900
----------------------------------------------------------------------
.../logging/log4j/core/filter/MapFilter.java | 17 ++++++++++++
.../core/filter/ThreadContextMapFilter.java | 28 +++++++++++++++++---
src/changes/changes.xml | 12 +++++++++
src/site/xdoc/manual/filters.xml | 19 ++++++-------
4 files changed, 63 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
[10/10] logging-log4j2 git commit: LOG4J2-1349 package change for
ContextData
Posted by rp...@apache.org.
LOG4J2-1349 package change for ContextData
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4d656deb
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4d656deb
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4d656deb
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: 4d656debd694c034beee0ccc86b5dffb6be770f1
Parents: 8d56062
Author: rpopma <rp...@apache.org>
Authored: Wed Aug 24 01:20:04 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Wed Aug 24 01:20:04 2016 +0900
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/core/filter/MapFilter.java | 2 +-
.../apache/logging/log4j/core/filter/ThreadContextMapFilter.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4d656deb/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
index 9fdad34..171fa79 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
@@ -24,7 +24,6 @@ import java.util.Objects;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.core.ContextData;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
@@ -36,6 +35,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.util.KeyValuePair;
import org.apache.logging.log4j.message.MapMessage;
import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.spi.ContextData;
/**
* A Filter that operates on a Map.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4d656deb/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
index 35debf4..3679fc3 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
@@ -24,7 +24,6 @@ import java.util.Map;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.core.ContextData;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
@@ -37,9 +36,10 @@ import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.impl.ContextDataFactory;
import org.apache.logging.log4j.core.impl.ContextDataInjector;
import org.apache.logging.log4j.core.impl.ContextDataInjectorFactory;
-import org.apache.logging.log4j.core.impl.MutableContextData;
import org.apache.logging.log4j.core.util.KeyValuePair;
import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.spi.ContextData;
+import org.apache.logging.log4j.spi.MutableContextData;
/**
* Filter based on a value in the Thread Context Map (MDC).
[02/10] logging-log4j2 git commit: [LOG4J2-1543] Remove deprecated
API Core org.apache.logging.log4j.core.util.Constants.UTF_8. Update
changes.xml.
Posted by rp...@apache.org.
[LOG4J2-1543] Remove deprecated API Core
org.apache.logging.log4j.core.util.Constants.UTF_8. Update changes.xml.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ed056d70
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ed056d70
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ed056d70
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: ed056d7051fafe4712dd5a1ff236e9ca34cb8d55
Parents: abe0a63
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 08:20:37 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 08:20:37 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ed056d70/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ad93231..a12926b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -133,7 +133,7 @@
Update JMS test from ActiveMQ 5.13.3 to 5.13.4.
</action>
<action issue="LOG4J2-1543" dev="ggregory" type="update" due-to="Gary Gregory">
- Remove deprecated API Core org.apache.logging.log4j.core.util.Constants.UTF_8.
+ Remove deprecated Core API org.apache.logging.log4j.core.util.Constants.UTF_8.
</action>
</release>
<release version="2.6.2" date="2016-07-05" description="GA Release 2.6.2">
[06/10] logging-log4j2 git commit: LOG4J2-1010 ThreadContextMapFilter
should get context data from the configured ContextDataInjector,
not hard-coded from ThreadContext
Posted by rp...@apache.org.
LOG4J2-1010 ThreadContextMapFilter should get context data from the configured ContextDataInjector, not hard-coded from ThreadContext
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ca90bc14
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ca90bc14
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ca90bc14
Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext
Commit: ca90bc142721a290cf416a31832160af1ad321cf
Parents: 24ac63b
Author: rpopma <rp...@apache.org>
Authored: Wed Aug 24 01:04:46 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Wed Aug 24 01:04:46 2016 +0900
----------------------------------------------------------------------
.../logging/log4j/core/filter/MapFilter.java | 17 ++++++++++++
.../core/filter/ThreadContextMapFilter.java | 28 +++++++++++++++++---
2 files changed, 41 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ca90bc14/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
index 09afb91..9fdad34 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/MapFilter.java
@@ -24,6 +24,7 @@ import java.util.Objects;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.core.ContextData;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
@@ -88,6 +89,22 @@ public class MapFilter extends AbstractFilter {
return match;
}
+ protected boolean filter(final ContextData data) {
+ boolean match = false;
+ for (final Map.Entry<String, List<String>> entry : map.entrySet()) {
+ final String toMatch = data.getValue(entry.getKey());
+ if (toMatch != null) {
+ match = entry.getValue().contains(toMatch);
+ } else {
+ match = false;
+ }
+ if ((!isAnd && match) || (isAnd && !match)) {
+ break;
+ }
+ }
+ return match;
+ }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ca90bc14/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
index f6d1c5c..35debf4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
@@ -24,15 +24,20 @@ import java.util.Map;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.ContextData;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.config.Node;
import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAliases;
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginElement;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.impl.ContextDataFactory;
+import org.apache.logging.log4j.core.impl.ContextDataInjector;
+import org.apache.logging.log4j.core.impl.ContextDataInjectorFactory;
+import org.apache.logging.log4j.core.impl.MutableContextData;
import org.apache.logging.log4j.core.util.KeyValuePair;
import org.apache.logging.log4j.message.Message;
@@ -40,8 +45,10 @@ import org.apache.logging.log4j.message.Message;
* Filter based on a value in the Thread Context Map (MDC).
*/
@Plugin(name = "ThreadContextMapFilter", category = Node.CATEGORY, elementType = Filter.ELEMENT_TYPE, printObject = true)
+@PluginAliases("ContextMapFilter")
public class ThreadContextMapFilter extends MapFilter {
+ private final ContextDataInjector injector = ContextDataInjectorFactory.createInjector();
private final String key;
private final String value;
@@ -90,8 +97,12 @@ public class ThreadContextMapFilter extends MapFilter {
private Result filter() {
boolean match = false;
if (useMap) {
+ ContextData currentContextData = null;
for (final Map.Entry<String, List<String>> entry : getMap().entrySet()) {
- final String toMatch = ThreadContext.get(entry.getKey());
+ if (currentContextData == null) {
+ currentContextData = currentContextData();
+ }
+ final String toMatch = currentContextData.getValue(entry.getKey());
if (toMatch != null) {
match = entry.getValue().contains(toMatch);
} else {
@@ -102,14 +113,23 @@ public class ThreadContextMapFilter extends MapFilter {
}
}
} else {
- match = value.equals(ThreadContext.get(key));
+ match = value.equals(currentContextData().getValue(key));
}
return match ? onMatch : onMismatch;
}
+ private ContextData currentContextData() {
+ return injector.injectContextData(null, reusableInstance());
+ }
+
+ private MutableContextData reusableInstance() {
+ // TODO if (Constants.ENABLE_THREADLOCALS) return thread-local instance
+ return ContextDataFactory.createContextData(); // creates temporary object
+ }
+
@Override
public Result filter(final LogEvent event) {
- return super.filter(event.getContextMap()) ? onMatch : onMismatch;
+ return super.filter(event.getContextData()) ? onMatch : onMismatch;
}
@PluginFactory