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 2024/04/03 15:54:39 UTC
(logging-log4j2) 05/05: Update docs
This is an automated email from the ASF dual-hosted git repository.
rgoers pushed a commit to branch ScopedContext
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit a54c44407a32e817d843c982ba3f65f45a37a6c6
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Wed Apr 3 08:54:23 2024 -0700
Update docs
---
src/changelog/.2.x.x/add_scoped_context.xml | 2 +-
src/site/asciidoc/manual/extending.adoc | 14 ++++++--------
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/changelog/.2.x.x/add_scoped_context.xml b/src/changelog/.2.x.x/add_scoped_context.xml
index 06db3eb0d5..fb74c22111 100644
--- a/src/changelog/.2.x.x/add_scoped_context.xml
+++ b/src/changelog/.2.x.x/add_scoped_context.xml
@@ -5,5 +5,5 @@
type="updated">
<issue id="kotlin-71" link="https://github.com/apache/logging-log4j-kotlin/issues/71"/>
<issue id="2214" link="https://github.com/apache/logging-log4j2/discussions/2214"/>
- <description format="asciidoc">Add ScopedContext to log4j-api and ScopedContextDataProvider in log4j-core.</description>
+ <description format="asciidoc">Add ScopedContext to log4j-api and ScopedContextDataProvider in log4j-core. Moved ContextDataProvider to log4j-api to allow custom data providers to be included in lookups.</description>
</entry>
diff --git a/src/site/asciidoc/manual/extending.adoc b/src/site/asciidoc/manual/extending.adoc
index 557e2748dd..03e84c26e7 100644
--- a/src/site/asciidoc/manual/extending.adoc
+++ b/src/site/asciidoc/manual/extending.adoc
@@ -587,16 +587,14 @@ ListAppender list2 = ListAppender.newBuilder().setName("List1").setEntryPerNewLi
[#Custom_ContextDataProvider]
== Custom ContextDataProvider
-The link:../log4j-core/apidocs/org/apache/logging/log4j/core/util/ContextDataProvider.html[`ContextDataProvider`]
-(introduced in Log4j 2.13.2) is an interface applications and libraries can use to inject
-additional key-value pairs into the LogEvent's context data. Log4j's
-link:../log4j-core/apidocs/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.html[`ThreadContextDataInjector`]
-uses `java.util.ServiceLoader` to locate and load `ContextDataProvider` instances.
+The link:../log4j-api/apidocs/org/apache/logging/log4j/spi/ContextDataProvider.html[`ContextDataProvider`]
+(introduced in Log4j 2.13.2 and moved to log4j-api in 2.24.0) is an interface applications and libraries
+can use to inject additional key-value pairs into the LogEvent's context data.
Log4j itself adds the ThreadContext data to the LogEvent using
-`org.apache.logging.log4j.core.impl.ThreadContextDataProvider`. Custom implementations
-should implement the `org.apache.logging.log4j.core.util.ContextDataProvider` interface and
+`org.apache.logging.log4j.spi.ThreadContextDataProvider`. Custom implementations
+should implement the `org.apache.logging.log4j.spi.ContextDataProvider` interface and
declare it as a service by defining the implmentation class in a file named
-`META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider`.
+`META-INF/services/org.apache.logging.log4j.spi.ContextDataProvider`.
== Custom ThreadContextMap implementations