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-1349-gcfree-threadcontext Commit: 947d9d626ae157f501dc10fdc930d69080623e6c Parents: 16bcf3f Author: rpopma <rpo...@apache.org> Authored: Sun Aug 28 22:20:25 2016 +0900 Committer: rpopma <rpo...@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 */