This is an automated email from the ASF dual-hosted git repository.
MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 9131a8ca7d3 [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20
9131a8ca7d3 is described below
commit 9131a8ca7d39375ff4e50a599f826e99e6935c85
Author: Piotr Przybylski <[email protected]>
AuthorDate: Sun Sep 6 23:06:30 2026 +0200
[FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20
Generated-by: Claude Code (Opus 5)
---
.../content.zh/docs/deployment/advanced/logging.md | 36 +++++++++++--------
docs/content.zh/docs/dev/configuration/overview.md | 4 +--
docs/content/docs/deployment/advanced/logging.md | 30 +++++++++-------
docs/content/docs/dev/configuration/overview.md | 4 +--
...ilityTest.java => MdcUtilsNullContextTest.java} | 42 +++++++++++++++++-----
flink-dist/pom.xml | 2 +-
flink-dist/src/main/assemblies/bin.xml | 2 +-
flink-dist/src/main/resources/META-INF/NOTICE | 2 +-
.../resources/META-INF/licenses/LICENSE.slf4j-api | 2 +-
flink-docs/pom.xml | 2 +-
.../flink-end-to-end-tests-table-api/pom.xml | 2 +-
flink-examples/pom.xml | 2 +-
flink-python/src/main/resources/META-INF/NOTICE | 2 +-
.../src/main/resources/archetype-resources/pom.xml | 2 +-
.../flink-test-utils-junit/pom.xml | 2 +-
.../src/main/resources/archetype-resources/pom.xml | 2 +-
.../src/main/resources/archetype-resources/pom.xml | 2 +-
pom.xml | 8 ++---
tools/ci/flink-ci-tools/pom.xml | 2 +-
tools/releasing/NOTICE-binary_PREAMBLE.txt | 2 +-
20 files changed, 96 insertions(+), 56 deletions(-)
diff --git a/docs/content.zh/docs/deployment/advanced/logging.md
b/docs/content.zh/docs/deployment/advanced/logging.md
index 2e1f23d201c..fe695b4bd2d 100644
--- a/docs/content.zh/docs/deployment/advanced/logging.md
+++ b/docs/content.zh/docs/deployment/advanced/logging.md
@@ -91,41 +91,49 @@ Flink 附带了 [Log4j API
bridge](https://logging.apache.org/log4j/log4j-2.2/lo
<a name="configuring-log4j1"></a>
-## 配置 Log4j1
+## 配置 Log4j 1 (reload4j)
-要将 Flink 与 [Log4j 1](https://logging.apache.org/log4j/1.2/) 一起使用,必须确保:
-- Classpath 中不存在
`org.apache.logging.log4j:log4j-core`、`org.apache.logging.log4j:log4j-slf4j-impl`
和 `org.apache.logging.log4j:log4j-1.2-api`;
-- 且 Classpath 中存在
`log4j:log4j`、`org.slf4j:slf4j-log4j12`、`org.apache.logging.log4j:log4j-to-slf4j`
和 `org.apache.logging.log4j:log4j-api`。
+要将 Flink 与 [reload4j](https://reload4j.qos.ch/) 一起使用,必须确保:
+- Classpath 中不存在
`org.apache.logging.log4j:log4j-core`、`org.apache.logging.log4j:log4j-slf4j2-impl`
和 `org.apache.logging.log4j:log4j-1.2-api`;
+- 且 Classpath 中存在
`ch.qos.reload4j:reload4j`、`org.slf4j:slf4j-reload4j`、`org.apache.logging.log4j:log4j-to-slf4j`
和 `org.apache.logging.log4j:log4j-api`。
-如果在 IDE 中使用 Log4j 1,则必须在 pom 文件中使用上述 Classpath 中应该存在的 jars 依赖项来替换 Classpath
中不应该存在的 jars 依赖项,并尽可能的排除那些传递依赖于 Classpath 中不存在 jars 的依赖项。
+如果在 IDE 中使用 reload4j,则必须在 pom 文件中使用上述 Classpath 中应该存在的 jars 依赖项来替换 Classpath
中不应该存在的 jars 依赖项,并尽可能的排除那些传递依赖于 Classpath 中不存在 jars 的依赖项。
对于 Flink 发行版,这意味着你必须
-- 从 `lib` 目录中移除 `log4j-core`,`log4j-slf4j-impl` 和 `log4j-1.2-api` jars;
-- 往 `lib` 目录中添加 `log4j`,`slf4j-log4j12` 和 `log4j-to-slf4j` jars;
+- 从 `lib` 目录中移除 `log4j-core`,`log4j-slf4j2-impl` 和 `log4j-1.2-api` jars;
+- 往 `lib` 目录中添加 `reload4j`,`slf4j-reload4j` 和 `log4j-to-slf4j` jars;
- 用适配的 Log4j1 版本替换 `conf` 目录中的所有 log4j 配置文件。
+{{< hint warning >}}
+
+[Reload4j](https://reload4j.qos.ch/) 是 Log4j 1.2.17 的一个持续维护的分支,保留了
`org.apache.log4j` 类和 Log4j 1 的配置格式。
+不能使用原来的 `log4j:log4j`,因为它的 SLF4J binding(`org.slf4j:slf4j-log4j12`)只适用于 SLF4J
1.7,Flink 自带的 SLF4J 2 会直接忽略它。
+请使用与 Flink 的 `slf4j-api`(2.x)版本一致的 `org.slf4j:slf4j-reload4j`。
+
+{{< /hint >}}
+
<a name="configuring-logback"></a>
-## 配置 logback
+## 配置 Logback
-要将 Flink 与 [logback](https://logback.qos.ch/) 一起使用,必须确保:
-- Classpath 中不存在 `org.apache.logging.log4j:log4j-slf4j-impl`;
+要将 Flink 与 [Logback](https://logback.qos.ch/) 一起使用,必须确保:
+- Classpath 中不存在 `org.apache.logging.log4j:log4j-slf4j2-impl`;
- Classpath 中存在 `ch.qos.logback:logback-core` 和
`ch.qos.logback:logback-classic`。
-如果在 IDE 中使用 logback,则必须在 pom 文件中使用上述 Classpath 中应该存在的 jars 依赖项来替换 Classpath
中不应该存在的 jars 依赖项,并尽可能的排除那些传递依赖于 Classpath 中不存在 jars 的依赖项。
+如果在 IDE 中使用 Logback,则必须在 pom 文件中使用上述 Classpath 中应该存在的 jars 依赖项来替换 Classpath
中不应该存在的 jars 依赖项,并尽可能的排除那些传递依赖于 Classpath 中不存在 jars 的依赖项。
对于 Flink 发行版,这意味着你必须
-- 从 `lib` 目录中移除 `log4j-slf4j-impl` jars;
+- 从 `lib` 目录中移除 `log4j-slf4j2-impl` jars;
- 向 `lib` 目录中添加 `logback-core` 和 `logback-classic` jars。
-Flink 发行版在 `conf` 目录中附带了以下 logback 配置文件,如果启用了 logback,则会自动使用这些文件:
+Flink 发行版在 `conf` 目录中附带了以下 Logback 配置文件,如果启用了 Logback,则会自动使用这些文件:
- `logback-session.properties`: Flink 命令行在启动基于 Kubernetes/Yarn 的 Session
集群时使用(例如 `kubernetes-session.sh`/`yarn-session.sh`);
- `logback-console.properties`:Job-/TaskManagers 在前台模式运行时使用(例如 Kubernetes);
- `logback.xml`: 命令行和 Job-/TaskManager 默认使用的日志配置。
{{< hint warning >}}
-Logback 1.3+ 需要 SLF4J 2,目前不支持。
+Flink 使用 SLF4J 2,低于 1.3 的 Logback 版本无法工作。请使用 Logback 1.5 或更高版本。
{{< /hint >}}
diff --git a/docs/content.zh/docs/dev/configuration/overview.md
b/docs/content.zh/docs/dev/configuration/overview.md
index e0930a237ac..8e1e3b8d7da 100644
--- a/docs/content.zh/docs/dev/configuration/overview.md
+++ b/docs/content.zh/docs/dev/configuration/overview.md
@@ -101,7 +101,7 @@ ext {
javaVersion = '1.8'
flinkVersion = '{{< version >}}'
scalaBinaryVersion = '{{< scala_version >}}'
- slf4jVersion = '1.7.36'
+ slf4jVersion = '2.0.20'
log4jVersion = '2.26.1'
}
sourceCompatibility = javaVersion
@@ -146,7 +146,7 @@ dependencies {
// connectors. These must be in the flinkShadowJar configuration!
// --------------------------------------------------------------
//flinkShadowJar "org.apache.flink:flink-connector-kafka:${flinkVersion}"
- runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
+ runtimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-api:${log4jVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
// Add test dependencies here.
diff --git a/docs/content/docs/deployment/advanced/logging.md
b/docs/content/docs/deployment/advanced/logging.md
index 82c8e6f7752..4432e986846 100644
--- a/docs/content/docs/deployment/advanced/logging.md
+++ b/docs/content/docs/deployment/advanced/logging.md
@@ -98,38 +98,44 @@ Flink ships with the [Log4j API
bridge](https://logging.apache.org/log4j/log4j-2
If you have custom Log4j 1 properties files or code that relies on Log4j 1,
please check out the official Log4j
[compatibility](https://logging.apache.org/log4j/2.x/manual/compatibility.html)
and [migration](https://logging.apache.org/log4j/2.x/manual/migration.html)
guides.
-## Configuring Log4j1
+## Configuring Log4j 1 (reload4j) <a name="configuring-log4j1" />
-To use Flink with [Log4j 1](https://logging.apache.org/log4j/1.2/) you must
ensure that:
-- `org.apache.logging.log4j:log4j-core`,
`org.apache.logging.log4j:log4j-slf4j-impl` and
`org.apache.logging.log4j:log4j-1.2-api` are not on the classpath,
-- `log4j:log4j`, `org.slf4j:slf4j-log4j12`,
`org.apache.logging.log4j:log4j-to-slf4j` and
`org.apache.logging.log4j:log4j-api` are on the classpath.
+To use Flink with [reload4j](https://reload4j.qos.ch/) you must ensure that:
+- `org.apache.logging.log4j:log4j-core`,
`org.apache.logging.log4j:log4j-slf4j2-impl` and
`org.apache.logging.log4j:log4j-1.2-api` are not on the classpath,
+- `ch.qos.reload4j:reload4j`, `org.slf4j:slf4j-reload4j`,
`org.apache.logging.log4j:log4j-to-slf4j` and
`org.apache.logging.log4j:log4j-api` are on the classpath.
In the IDE this means you have to replace such dependencies defined in your
pom, and possibly add exclusions on dependencies that transitively depend on
them.
For Flink distributions this means you have to
-- remove the `log4j-core`, `log4j-slf4j-impl` and `log4j-1.2-api` jars from
the `lib` directory,
-- add the `log4j`, `slf4j-log4j12` and `log4j-to-slf4j` jars to the `lib`
directory,
+- remove the `log4j-core`, `log4j-slf4j2-impl` and `log4j-1.2-api` jars from
the `lib` directory,
+- add the `reload4j`, `slf4j-reload4j` and `log4j-to-slf4j` jars to the `lib`
directory,
- replace all log4j properties files in the `conf` directory with
Log4j1-compliant versions.
-## Configuring logback
+{{< hint warning >}}
+[Reload4j](https://reload4j.qos.ch/) is a maintained fork of Log4j 1.2.17; it
keeps the `org.apache.log4j` classes and the Log4j 1 configuration format.
+The original `log4j:log4j` artifact cannot be used, because its SLF4J binding
(`org.slf4j:slf4j-log4j12`) exists for SLF4J 1.7 only and is ignored by the
SLF4J 2 version Flink ships with.
+Use an `org.slf4j:slf4j-reload4j` version matching Flink's `slf4j-api` (2.x).
+{{< /hint >}}
+
+## Configuring Logback
-To use Flink with [logback](https://logback.qos.ch/) you must ensure that:
-- `org.apache.logging.log4j:log4j-slf4j-impl` is not on the classpath,
+To use Flink with [Logback](https://logback.qos.ch/) you must ensure that:
+- `org.apache.logging.log4j:log4j-slf4j2-impl` is not on the classpath,
- `ch.qos.logback:logback-core` and `ch.qos.logback:logback-classic` are on
the classpath.
In the IDE this means you have to replace such dependencies defined in your
pom, and possibly add exclusions on dependencies that transitively depend on
them.
For Flink distributions this means you have to
-- remove the `log4j-slf4j-impl` jar from the `lib` directory,
+- remove the `log4j-slf4j2-impl` jar from the `lib` directory,
- add the `logback-core`, and `logback-classic` jars to the `lib` directory.
-The Flink distribution ships with the following logback configuration files in
the `conf` directory, which are used automatically if logback is enabled:
+The Flink distribution ships with the following Logback configuration files in
the `conf` directory, which are used automatically if Logback is enabled:
- `logback-session.properties`: used by the command line interface when
starting a Kubernetes/Yarn session cluster (i.e.,
`kubernetes-session.sh`/`yarn-session.sh`)
- `logback-console.properties`: used for Job-/TaskManagers if they are run in
the foreground (e.g., Kubernetes)
- `logback.xml`: used for command line interface and Job-/TaskManagers by
default
{{< hint warning >}}
-Logback 1.3+ requires SLF4J 2, which is currently not supported.
+Flink uses SLF4J 2, Logback versions older than 1.3 will not work. Please use
Logback 1.5 or newer.
{{< /hint >}}
## Best practices for developers
diff --git a/docs/content/docs/dev/configuration/overview.md
b/docs/content/docs/dev/configuration/overview.md
index 730b5bb9255..db21ac853b3 100644
--- a/docs/content/docs/dev/configuration/overview.md
+++ b/docs/content/docs/dev/configuration/overview.md
@@ -103,7 +103,7 @@ ext {
javaVersion = '1.8'
flinkVersion = '{{< version >}}'
scalaBinaryVersion = '{{< scala_version >}}'
- slf4jVersion = '1.7.36'
+ slf4jVersion = '2.0.20'
log4jVersion = '2.26.1'
}
sourceCompatibility = javaVersion
@@ -148,7 +148,7 @@ dependencies {
// connectors. These must be in the flinkShadowJar configuration!
// --------------------------------------------------------------
//flinkShadowJar "org.apache.flink:flink-connector-kafka:${flinkVersion}"
- runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
+ runtimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-api:${log4jVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
// Add test dependencies here.
diff --git
a/flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java
b/flink-core/src/test/java/org/apache/flink/util/MdcUtilsNullContextTest.java
similarity index 61%
rename from
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java
rename to
flink-core/src/test/java/org/apache/flink/util/MdcUtilsNullContextTest.java
index 5cef5564551..044978f55eb 100644
---
a/flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java
+++
b/flink-core/src/test/java/org/apache/flink/util/MdcUtilsNullContextTest.java
@@ -32,16 +32,17 @@ import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
@Isolated
-public class MdcLogbackCompatibilityTest {
+class MdcUtilsNullContextTest {
private MDCAdapter originalAdapter;
@BeforeEach
void setUp() throws Exception {
originalAdapter = getCurrentMDCAdapter();
- setMDCAdapter(new BasicMDCAdapter());
+ setMDCAdapter(new NullRejectingMDCAdapter());
}
@AfterEach
@@ -50,14 +51,24 @@ public class MdcLogbackCompatibilityTest {
}
/**
- * The {@link MDC#setContextMap(Map)} method in Logback 1.2 does not
accept nulls, unlike Log4j
- * and Logback 1.3.2. BasicMDCAdapter is used to replicate this behavior
for testing without
- * bundling Logback into flink-core. See
https://issues.apache.org/jira/browse/FLINK-36227 for
- * details.
+ * Restoring an absent (null) MDC context must never fail.
+ *
+ * <p>Backends are free to return null from {@link
MDC#getCopyOfContextMap()}, and SLF4J API did
+ * not require them to accept that null back in {@link
MDC#setContextMap(Map)} until SLF4J
+ * 2.0.0.
+ *
+ * <ul>
+ * <li>Logback 1.2 (SLF4J 1.7) - can return null, rejects null
+ * <li>Logback 1.3.0-1.3.1 (SLF4J 2) - can return null, rejects null
+ * <li>Log4j 2.26.1 (both SLF4J versions) - never returns null, rejects
null
+ * </ul>
+ *
+ * <p>See https://issues.apache.org/jira/browse/FLINK-36227 for historical
context.
*/
@Test
void testContextRestorationWorksWithNullContext() {
assertThat(MDC.getCopyOfContextMap()).isNull();
+ assertThrows(NullPointerException.class, () ->
MDC.setContextMap(null));
MdcUtils.MdcCloseable restoreContext =
MdcUtils.withContext(Collections.singletonMap("k", "v"));
@@ -67,14 +78,29 @@ public class MdcLogbackCompatibilityTest {
}
private MDCAdapter getCurrentMDCAdapter() throws Exception {
- Field adapterField = MDC.class.getDeclaredField("mdcAdapter");
+ Field adapterField = MDC.class.getDeclaredField("MDC_ADAPTER");
adapterField.setAccessible(true);
return (MDCAdapter) adapterField.get(null);
}
private void setMDCAdapter(MDCAdapter adapter) throws Exception {
- Field adapterField = MDC.class.getDeclaredField("mdcAdapter");
+ Field adapterField = MDC.class.getDeclaredField("MDC_ADAPTER");
adapterField.setAccessible(true);
adapterField.set(null, adapter);
}
+
+ private static class NullRejectingMDCAdapter extends BasicMDCAdapter {
+ @Override
+ public Map<String, String> getCopyOfContextMap() {
+ return null;
+ }
+
+ @Override
+ public void setContextMap(Map<String, String> contextMap) {
+ if (contextMap == null) {
+ throw new NullPointerException("contextMap cannot be null");
+ }
+ super.setContextMap(contextMap);
+ }
+ }
}
diff --git a/flink-dist/pom.xml b/flink-dist/pom.xml
index 5dc15a3d1af..5e469968478 100644
--- a/flink-dist/pom.xml
+++ b/flink-dist/pom.xml
@@ -167,7 +167,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>compile</scope>
</dependency>
diff --git a/flink-dist/src/main/assemblies/bin.xml
b/flink-dist/src/main/assemblies/bin.xml
index ea855a0a4c1..1334f66ba62 100644
--- a/flink-dist/src/main/assemblies/bin.xml
+++ b/flink-dist/src/main/assemblies/bin.xml
@@ -40,7 +40,7 @@ under the License.
<includes>
<include>org.apache.logging.log4j:log4j-api</include>
<include>org.apache.logging.log4j:log4j-core</include>
-
<include>org.apache.logging.log4j:log4j-slf4j-impl</include>
+
<include>org.apache.logging.log4j:log4j-slf4j2-impl</include>
<include>org.apache.logging.log4j:log4j-1.2-api</include>
<include>org.apache.logging.log4j:log4j-layout-template-json</include>
</includes>
diff --git a/flink-dist/src/main/resources/META-INF/NOTICE
b/flink-dist/src/main/resources/META-INF/NOTICE
index 2357174f382..9e8b2ebe238 100644
--- a/flink-dist/src/main/resources/META-INF/NOTICE
+++ b/flink-dist/src/main/resources/META-INF/NOTICE
@@ -34,7 +34,7 @@ See bundled license files for details.
This project bundles the following dependencies under the MIT/X11 license.
See bundled license files for details.
-- org.slf4j:slf4j-api:1.7.36
+- org.slf4j:slf4j-api:2.0.20
This project bundles the following dependencies under the CDDL 1.1 license.
See bundled license files for details.
diff --git a/flink-dist/src/main/resources/META-INF/licenses/LICENSE.slf4j-api
b/flink-dist/src/main/resources/META-INF/licenses/LICENSE.slf4j-api
index 93119e70ed5..76e167b31b4 100644
--- a/flink-dist/src/main/resources/META-INF/licenses/LICENSE.slf4j-api
+++ b/flink-dist/src/main/resources/META-INF/licenses/LICENSE.slf4j-api
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2017 QOS.ch
+Copyright (c) 2004-2023 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
diff --git a/flink-docs/pom.xml b/flink-docs/pom.xml
index 2426b626264..fdafaf7df2f 100644
--- a/flink-docs/pom.xml
+++ b/flink-docs/pom.xml
@@ -153,7 +153,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>compile</scope>
</dependency>
diff --git a/flink-end-to-end-tests/flink-end-to-end-tests-table-api/pom.xml
b/flink-end-to-end-tests/flink-end-to-end-tests-table-api/pom.xml
index d7e88114adf..b9ac5f36350 100644
--- a/flink-end-to-end-tests/flink-end-to-end-tests-table-api/pom.xml
+++ b/flink-end-to-end-tests/flink-end-to-end-tests-table-api/pom.xml
@@ -79,7 +79,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
diff --git a/flink-examples/pom.xml b/flink-examples/pom.xml
index 87e9555167d..b1ea883738e 100644
--- a/flink-examples/pom.xml
+++ b/flink-examples/pom.xml
@@ -56,7 +56,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>compile</scope>
</dependency>
diff --git a/flink-python/src/main/resources/META-INF/NOTICE
b/flink-python/src/main/resources/META-INF/NOTICE
index 80e15336e3a..7fab146e777 100644
--- a/flink-python/src/main/resources/META-INF/NOTICE
+++ b/flink-python/src/main/resources/META-INF/NOTICE
@@ -46,7 +46,7 @@ See bundled license files for details.
- net.razorvine:pyrolite:4.13
- org.checkerframework:checker-qual:3.42.0
- io.github.classgraph:classgraph:4.8.162
-- org.slf4j:slf4j-api:1.7.36
+- org.slf4j:slf4j-api:2.0.20
- args4j:args4j:2.33
The bundled Apache Beam dependencies bundle the following dependencies under
the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
diff --git
a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml
b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml
index 235c104ac81..da0fb142016 100644
---
a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml
+++
b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml
@@ -82,7 +82,7 @@ under the License.
<!-- These dependencies are excluded from the application JAR
by default. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
<scope>runtime</scope>
</dependency>
diff --git a/flink-test-utils-parent/flink-test-utils-junit/pom.xml
b/flink-test-utils-parent/flink-test-utils-junit/pom.xml
index ba8ec04743d..f1398b1247f 100644
--- a/flink-test-utils-parent/flink-test-utils-junit/pom.xml
+++ b/flink-test-utils-parent/flink-test-utils-junit/pom.xml
@@ -54,7 +54,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>compile</scope>
</dependency>
diff --git
a/flink-walkthroughs/flink-walkthrough-datastream-java/src/main/resources/archetype-resources/pom.xml
b/flink-walkthroughs/flink-walkthrough-datastream-java/src/main/resources/archetype-resources/pom.xml
index 2ae8fa60671..e8f7e42daf5 100644
---
a/flink-walkthroughs/flink-walkthrough-datastream-java/src/main/resources/archetype-resources/pom.xml
+++
b/flink-walkthroughs/flink-walkthrough-datastream-java/src/main/resources/archetype-resources/pom.xml
@@ -93,7 +93,7 @@ under the License.
<!-- These dependencies are excluded from the application JAR
by default. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
<scope>runtime</scope>
</dependency>
diff --git
a/flink-walkthroughs/flink-walkthrough-table-java/src/main/resources/archetype-resources/pom.xml
b/flink-walkthroughs/flink-walkthrough-table-java/src/main/resources/archetype-resources/pom.xml
index d4eb3cb2467..e7c7869d708 100644
---
a/flink-walkthroughs/flink-walkthrough-table-java/src/main/resources/archetype-resources/pom.xml
+++
b/flink-walkthroughs/flink-walkthrough-table-java/src/main/resources/archetype-resources/pom.xml
@@ -82,7 +82,7 @@ under the License.
<!-- Add logging framework for console output when running in
the IDE. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
<scope>runtime</scope>
</dependency>
diff --git a/pom.xml b/pom.xml
index 25dedde3609..956a89d03a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,7 +133,7 @@ under the License.
<flink.markBundledAsOptional>true</flink.markBundledAsOptional>
<source.java.version>11</source.java.version>
<target.java.version>17</target.java.version>
- <slf4j.version>1.7.36</slf4j.version>
+ <slf4j.version>2.0.20</slf4j.version>
<log4j.version>2.26.1</log4j.version>
<!-- Overwrite default values from parent pom.
IntelliJ IDEA is (sometimes?) using those values to
choose target language level
@@ -308,7 +308,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
@@ -541,7 +541,7 @@ under the License.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
@@ -2286,7 +2286,7 @@ under the License.
<dependency>log4j:log4j</dependency>
<dependency>org.slf4j:slf4j-log4j12</dependency>
<!-- log4j2 -->
-
<dependency>org.apache.logging.log4j:log4j-slf4j-impl</dependency>
+
<dependency>org.apache.logging.log4j:log4j-slf4j2-impl</dependency>
<dependency>org.apache.logging.log4j:log4j-api</dependency>
<dependency>org.apache.logging.log4j:log4j-core</dependency>
<dependency>org.apache.logging.log4j:log4j-1.2-api</dependency>
diff --git a/tools/ci/flink-ci-tools/pom.xml b/tools/ci/flink-ci-tools/pom.xml
index 0a6677170f8..449a347d88c 100644
--- a/tools/ci/flink-ci-tools/pom.xml
+++ b/tools/ci/flink-ci-tools/pom.xml
@@ -55,7 +55,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <artifactId>log4j-slf4j2-impl</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
diff --git a/tools/releasing/NOTICE-binary_PREAMBLE.txt
b/tools/releasing/NOTICE-binary_PREAMBLE.txt
index 46c43e8c32b..7ea6c537132 100644
--- a/tools/releasing/NOTICE-binary_PREAMBLE.txt
+++ b/tools/releasing/NOTICE-binary_PREAMBLE.txt
@@ -10,7 +10,7 @@ This project bundles the following dependencies under the
Apache Software Licens
- org.apache.logging.log4j:log4j-api:2.26.1
- org.apache.logging.log4j:log4j-core:2.26.1
-- org.apache.logging.log4j:log4j-slf4j-impl:2.26.1
+- org.apache.logging.log4j:log4j-slf4j2-impl:2.26.1
- org.apache.logging.log4j:log4j-1.2-api:2.26.1
- org.apache.logging.log4j:log4j-layout-template-json:2.26.1