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 2018/09/23 17:19:50 UTC

[2/6] logging-log4j-audit git commit: [LOG4J2-2421] iterate only over the defined request context attributes as the ThreadContext can have others extra

[LOG4J2-2421] iterate only over the defined request context attributes as the ThreadContext can have others extra


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/baa2d74d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/baa2d74d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/baa2d74d

Branch: refs/heads/master
Commit: baa2d74d9e4437629d02f6670d87c5430d6e5e69
Parents: af89554
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Mon Sep 17 17:14:11 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Mon Sep 17 17:14:11 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/audit/AbstractEventLogger.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/baa2d74d/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
index 575b950..b3ad586 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
@@ -195,9 +195,9 @@ public abstract class AbstractEventLogger {
                                              " is missing required Thread Context values for " + errors.toString());
         }
 
-        for (Map.Entry<String, String> entry : ThreadContext.getImmutableContext().entrySet()) {
+        for (Map.Entry<String, Attribute> entry : reqCtxAttributes.entrySet()) {
             Attribute attribute = reqCtxAttributes.get(entry.getKey());
-            if (attribute == null) {
+            if (!ThreadContext.containsKey(entry.getKey())) {
                 continue;
             }
             Set<Constraint> constraintList = attribute.getConstraints();