From 0c1ca54543811fefcb19cd8d9f37c7caca1abbba Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Mon, 30 Sep 2024 17:10:42 +0200 Subject: [PATCH] Remove `log4j-core` dependency from SLF4J bridges To prepare for the migration between Log4j Core 2 and Log4j Core 3 this PR removes the runtime dependency on `log4j-core` from both `log4j-slf4j-impl` and `log4j-slf4j2-impl`. This explicitly reverts the changes in [LOG4J2-3601](https://issues.apache.org/jira/browse/LOG4J2-3601) --- log4j-slf4j-impl/pom.xml | 42 +++++++++++------ log4j-slf4j2-impl/pom.xml | 20 ++++++-- src/changelog/.2.x.x/.release-notes.adoc.ftl | 47 ++++++++++++++++++- .../.2.x.x/slf4j_impl_remove_log4j_core.xml | 9 ++++ 4 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 src/changelog/.2.x.x/slf4j_impl_remove_log4j_core.xml diff --git a/log4j-slf4j-impl/pom.xml b/log4j-slf4j-impl/pom.xml index 32d129b150c..4e391249722 100644 --- a/log4j-slf4j-impl/pom.xml +++ b/log4j-slf4j-impl/pom.xml @@ -49,71 +49,83 @@ + org.osgi org.osgi.core provided + org.apache.logging.log4j log4j-api + org.slf4j slf4j-api + org.apache.logging.log4j - log4j-core - runtime + log4j-api-test + test + org.apache.logging.log4j - log4j-api-test + log4j-core test - - - org.slf4j - slf4j-api - - + org.apache.logging.log4j log4j-core-test test + org.apache.logging.log4j log4j-to-slf4j test - - - org.slf4j - slf4j-api - - + + + org.assertj + assertj-core + test + + org.apache.commons commons-csv test + org.apache.commons commons-lang3 test + org.junit.jupiter junit-jupiter-engine test + + + org.junit.jupiter + junit-jupiter-params + test + + org.junit.vintage junit-vintage-engine test + diff --git a/log4j-slf4j2-impl/pom.xml b/log4j-slf4j2-impl/pom.xml index 20fcad9700b..c6947a81ba4 100644 --- a/log4j-slf4j2-impl/pom.xml +++ b/log4j-slf4j2-impl/pom.xml @@ -50,69 +50,83 @@ + org.osgi org.osgi.core provided + org.apache.logging.log4j log4j-api + org.slf4j slf4j-api + org.apache.logging.log4j - log4j-core - runtime + log4j-api-test + test + org.apache.logging.log4j - log4j-api-test + log4j-core test + org.apache.logging.log4j log4j-core-test test + org.apache.logging.log4j log4j-to-slf4j test + org.assertj assertj-core test + org.apache.commons commons-csv test + org.apache.commons commons-lang3 test + org.junit.jupiter junit-jupiter-engine test + org.junit.jupiter junit-jupiter-params test + org.junit.vintage junit-vintage-engine test + diff --git a/src/changelog/.2.x.x/.release-notes.adoc.ftl b/src/changelog/.2.x.x/.release-notes.adoc.ftl index 319c60da1d9..a72161243f3 100644 --- a/src/changelog/.2.x.x/.release-notes.adoc.ftl +++ b/src/changelog/.2.x.x/.release-notes.adoc.ftl @@ -22,8 +22,51 @@ This releases contains ... -=== JMX changes +=== SLF4J implementations (bridges) -Starting in version 2.24.0, JMX support is disabled by default and can be re-enabled via the `log4j2.disableJmx=false` system property. +To prepare for the migration between Log4j Core 2 and Log4j Core 3, the +xref:components.adoc#log4j-slf4j-impl[`log4j-slf4j-impl`] +and +xref:components.adoc#log4j-slf4j-impl[`log4j-slf4j2-impl`] +bridges between SLF4J and Log4j API, no longer depend on Log4j Core 2. +Users should specify the logging implementation of their choice explicitly in their dependency manager: + +[tabs] +==== +Maven:: ++ +We assume you use xref:components.adoc#log4j-bom[`log4j-bom`] for dependency management. ++ +[source,xml] +---- + + + org.apache.logging.log4j + log4j-slf4j2-impl + runtime + + + + + org.apache.logging.log4j + log4j-core + runtime + +---- + +Gradle:: ++ +We assume you use xref:components.adoc#log4j-bom[`log4j-bom`] for dependency management. ++ +[source,groovy] +---- +// Bridge from SLF4J 2 to Log4j API +runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl' +// Log4j API implementation +runtimeOnly 'org.apache.logging.log4j:log4j-core' +---- +==== + +See xref:manual/installation.adoc#impl-core[Installing Log4j Core] for more details. <#include "../.changelog.adoc.ftl"> diff --git a/src/changelog/.2.x.x/slf4j_impl_remove_log4j_core.xml b/src/changelog/.2.x.x/slf4j_impl_remove_log4j_core.xml new file mode 100644 index 00000000000..15c2dd8967f --- /dev/null +++ b/src/changelog/.2.x.x/slf4j_impl_remove_log4j_core.xml @@ -0,0 +1,9 @@ + + + Removes Log4j Core from the runtime dependencies of `log4j-slf4j-impl` and + `log4j-slf4j2-impl` + +