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/28 15:04:13 UTC

[1/7] logging-log4j2 git commit: Add Scala API to documentation about dependencies

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure 4d9b9f3b6 -> 25148ca31


Add Scala API to documentation about dependencies


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: f936a6d0f6f7b0920443982ce75239043f9dac15
Parents: 139f57b
Author: Mikael St�ldal <mi...@staldal.nu>
Authored: Sun Aug 28 12:42:09 2016 +0200
Committer: Mikael St�ldal <mi...@staldal.nu>
Committed: Sun Aug 28 12:42:09 2016 +0200

----------------------------------------------------------------------
 src/site/xdoc/maven-artifacts.xml.vm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f936a6d0/src/site/xdoc/maven-artifacts.xml.vm
----------------------------------------------------------------------
diff --git a/src/site/xdoc/maven-artifacts.xml.vm b/src/site/xdoc/maven-artifacts.xml.vm
index da25745..0bf3a7e 100644
--- a/src/site/xdoc/maven-artifacts.xml.vm
+++ b/src/site/xdoc/maven-artifacts.xml.vm
@@ -375,6 +375,34 @@ dependencies {
   compile group: 'org.apache.logging.log4j', name: 'log4j-iostreams', version: '${Log4jReleaseVersion}'
 }
 ]]></pre>
+        <h4>Scala API</h4>
+        <p>A convenient Scala wrapper for the Logger API</p>
+        <code>build.sbt</code>
+        <pre class="prettyprint linenums"><![CDATA[
+"org.apache.logging.log4j" %% "log4j-api-scala" % "${Log4jReleaseVersion}"
+]]></pre>
+        <code>pom.xml</code>
+        <pre class="prettyprint linenums"><![CDATA[
+<dependencies>
+  <dependency>
+    <groupId>org.apache.logging.log4j</groupId>
+    <artifactId>log4j-api-scala_2.11</artifactId>
+    <version>${Log4jReleaseVersion}</version>
+  </dependency>
+</dependencies>
+]]></pre>
+        <code>ivy.xml</code>
+        <pre class="prettyprint linenums"><![CDATA[
+<dependencies>
+  <dependency org="org.apache.logging.log4j" name="log4j-api-scala_2.11" rev="${Log4jReleaseVersion}" />
+</dependencies>
+]]></pre>
+        <code>build.gradle</code>
+        <pre class="prettyprint linenums"><![CDATA[
+dependencies {
+  compile group: 'org.apache.logging.log4j', name: 'log4j-api-scala_2.11', version: '${Log4jReleaseVersion}'
+}
+]]></pre>
       </subsection>
     </section>
   </body>


[2/7] 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/16bcf3f0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/16bcf3f0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/16bcf3f0

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 16bcf3f0711bba2140b68f969cf64e9c5c446fc4
Parents: 4d9b9f3 f936a6d
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 28 21:27:02 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 28 21:27:02 2016 +0900

----------------------------------------------------------------------
 src/site/xdoc/maven-artifacts.xml.vm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------



[7/7] logging-log4j2 git commit: LOG4J2-1010 implement the new ContextDataInjector::rawContextData() method as good as we can.

Posted by rp...@apache.org.
LOG4J2-1010 implement the new ContextDataInjector::rawContextData() method as good as we can.

Note: at this stage the rawContextData() method implementation does not perform better than the inject method.
In LOG4J2-1349 we move the ContextData interface to the log4j-api module and we introduce ContextData-based implementations of the ThreadContextMap interface. Here we can provide a much more efficiently performing implementation.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/25148ca3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/25148ca3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/25148ca3

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 25148ca31ea2ba8f96f03bc36eb3963b802db46b
Parents: 16eca7f
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 29 00:04:03 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 29 00:04:03 2016 +0900

----------------------------------------------------------------------
 .../core/impl/ThreadContextDataInjector.java    | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/25148ca3/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
index af534fb..1e81f1d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
@@ -66,6 +66,14 @@ public class ThreadContextDataInjector  {
             return reusable;
         }
 
+        @Override
+        public ContextData rawContextData() {
+            // TODO LOG4J2-1349: DefaultThreadContextMap itself implements the ContextData interface
+            final MutableContextData result = ContextDataFactory.createContextData();
+            copyThreadContextMap(ThreadContext.getImmutableContext(), result);
+            return result;
+        }
+
         /**
          * Copies key-value pairs from the specified map into the specified {@code MutableContextData}.
          *
@@ -109,6 +117,13 @@ public class ThreadContextDataInjector  {
 //            reusable.putAll(immutableCopy);
             return reusable;
         }
+
+        @Override
+        public ContextData rawContextData() {
+            // TODO LOG4J2-1349
+            //return ((AbstractGarbageFreeMutableThreadContext) ThreadContext.getThreadContextMap()).getContextData();
+            return null;
+        }
     }
 
     /**
@@ -146,6 +161,13 @@ public class ThreadContextDataInjector  {
 //            reusable.putAll(immutableCopy);
             return reusable;
         }
+
+        @Override
+        public ContextData rawContextData() {
+            // TODO LOG4J2-1349
+            //return ((AbstractCopyOnWriteMutableThreadContext) ThreadContext.getThreadContextMap()).getContextData();
+            return null;
+        }
     }
 
     /**


[5/7] logging-log4j2 git commit: LOG4J2-1010 added method ContextDataInjector::rawContextData()

Posted by rp...@apache.org.
LOG4J2-1010 added method ContextDataInjector::rawContextData()

 This method is intended to give fast access to the underlying context data, for use in filters and lookups.
 The idea is that this method does *not* need to guarantee that the returned object can safely be passed off to another thread, and this looser guarantee allows us to avoid making a copy of the data.


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: d057eb204aac88bc4a58c6aa694dfac6063d228a
Parents: 07162be
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 28 23:57:12 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 28 23:57:12 2016 +0900

----------------------------------------------------------------------
 .../log4j/core/impl/ContextDataInjector.java        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d057eb20/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
index c1bd4b4..7fe4c53 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.core.impl;
 
 import java.util.List;
 
+import org.apache.logging.log4j.core.ContextData;
 import org.apache.logging.log4j.core.config.Property;
 
 /**
@@ -47,6 +48,10 @@ public interface ContextDataInjector {
     /**
      * Returns a {@code MutableContextData} object initialized with the specified properties and the appropriate
      * context data. The returned value may be the specified parameter or a different object.
+     * <p>
+     * Thread-safety note: The returned object can safely be passed off to another thread: future changes in the
+     * underlying context data will not be reflected in the returned object.
+     * </p>
      *
      * @param properties Properties from the log4j configuration to be added to the resulting ContextData. May be
      *          {@code null} or empty
@@ -55,4 +60,15 @@ public interface ContextDataInjector {
      *          context data. The returned value may be the specified parameter or a different object.
      */
     MutableContextData injectContextData(final List<Property> properties, final MutableContextData reusable);
+
+    /**
+     * Returns a {@code ContextData} object reflecting the current state of the context.
+     * <p>
+     * Thread-safety note: The returned object can only be safely used <em>in the current thread</em>. Changes in the
+     * underlying context may or may not be reflected in the returned object, depending on the context data source and
+     * the implementation of this method. It is not safe to pass the returned object to another thread.
+     * </p>
+     * @return a {@code ContextData} object reflecting the current state of the context
+     */
+    ContextData rawContextData();
 }


[4/7] logging-log4j2 git commit: LOG4J2-1010 improved ContextDataInjector documentation

Posted by rp...@apache.org.
LOG4J2-1010 improved ContextDataInjector documentation


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/07162bea
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/07162bea
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/07162bea

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 07162bea686913a21f0b7688d1c8ad50f9b7b691
Parents: 947d9d6
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 28 22:24:13 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 28 22:24:13 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/impl/ContextDataInjector.java    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/07162bea/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
index 5b74968..c1bd4b4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java
@@ -28,8 +28,13 @@ import org.apache.logging.log4j.core.config.Property;
  * </p><p>
  * In some asynchronous models, work may be delegated to several threads, while conceptually this work shares the same
  * context. In such models, storing context data in {@code ThreadLocal} variables is not convenient or desirable.
- * By specifying a custom {@code ContextDataInjectorFactory}, users can initialize log events with context data from
- * any arbitrary context.
+ * Users can configure the {@code ContextDataInjectorFactory} to provide custom {@code ContextDataInjector} objects,
+ * in order to initialize log events with context data from any arbitrary context.
+ * </p><p>
+ * When providing a custom {@code ContextDataInjector}, be aware that the {@code ContextDataFactory} may be invoked
+ * multiple times by the various components in Log4j that need access to context data.
+ * This includes the object(s) that populate log events, but also various lookups and filters that look at
+ * context data to determine whether an event should be logged.
  * </p>
  *
  * @see ContextDataInjectorFactory
@@ -43,7 +48,8 @@ public interface ContextDataInjector {
      * Returns a {@code MutableContextData} object initialized with the specified properties and the appropriate
      * context data. The returned value may be the specified parameter or a different object.
      *
-     * @param properties Properties from the log4j configuration to be added to the resulting ContextData
+     * @param properties Properties from the log4j configuration to be added to the resulting ContextData. May be
+     *          {@code null} or empty
      * @param reusable a {@code MutableContextData} instance that may be reused to avoid creating temporary objects
      * @return a {@code MutableContextData} instance initialized with the specified properties and the appropriate
      *          context data. The returned value may be the specified parameter or a different object.


[6/7] logging-log4j2 git commit: LOG4J2-1010 use the new ContextDataInjector::rawContextData() method to get fast access to the underlying context data in filters and lookups.

Posted by rp...@apache.org.
LOG4J2-1010 use the new ContextDataInjector::rawContextData() method to get fast access to the underlying context data in filters and lookups.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/16eca7fc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/16eca7fc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/16eca7fc

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 16eca7fce0d9874332e381f61b23fbfd2fd9d05e
Parents: d057eb2
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 28 23:58:19 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 28 23:58:19 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/filter/DynamicThresholdFilter.java   | 9 +--------
 .../logging/log4j/core/filter/ThreadContextMapFilter.java   | 9 +--------
 .../apache/logging/log4j/core/lookup/ContextMapLookup.java  | 9 +--------
 3 files changed, 3 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/16eca7fc/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
index d6146d7..e8bdf37 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilter.java
@@ -32,10 +32,8 @@ import org.apache.logging.log4j.core.config.plugins.Plugin;
 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;
 
@@ -158,12 +156,7 @@ public final class DynamicThresholdFilter extends AbstractFilter {
     }
 
     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
+        return injector.rawContextData();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/16eca7fc/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..49b7044 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
@@ -34,10 +34,8 @@ 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;
 
@@ -119,12 +117,7 @@ public class ThreadContextMapFilter extends MapFilter {
     }
 
     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
+        return injector.rawContextData();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/16eca7fc/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java
index 57818bc..bfbc5ea 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java
@@ -20,10 +20,8 @@ import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.ContextData;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
-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;
 
 /**
  * Looks up keys from the context. By default this is the {@link ThreadContext}, but users may
@@ -46,12 +44,7 @@ public class ContextMapLookup implements StrLookup {
     }
 
     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
+        return injector.rawContextData();
     }
 
     /**


[3/7] logging-log4j2 git commit: LOG4J2-1010 document that the factory method for ContextDataInjectors may be called multiple times

Posted by rp...@apache.org.
LOG4J2-1010 document that the factory method for ContextDataInjectors may be called multiple times


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/947d9d62
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/947d9d62
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/947d9d62

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 947d9d626ae157f501dc10fdc930d69080623e6c
Parents: 16bcf3f
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 28 22:20:25 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 28 22:20:25 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/impl/ContextDataInjectorFactory.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/947d9d62/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
index ac5c38c..f35e30a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
@@ -46,6 +46,12 @@ public class ContextDataInjectorFactory {
      * <p>
      * Users may use this system property to specify the fully qualified class name of a class that implements the
      * {@code ContextDataInjector} interface.
+     * </p><p>
+     * When providing a custom {@code ContextDataInjector}, be aware that this method may be invoked multiple times by
+     * the various components in Log4j that need access to context data.
+     * This includes the object(s) that populate log events, but also various lookups and filters that look at
+     * context data to determine whether an event should be logged.
+     * </p>
      *
      * @return a ContextDataInjector that populates the {@code ContextData} of all {@code LogEvent} objects
      */