You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "piotrp (via GitHub)" <gi...@apache.org> on 2026/09/06 21:32:16 UTC
[PR] [FLINK-XXXX] Update SLF4J from 1.7.36 to 2.0.19 [flink]
piotrp opened a new pull request, #29120:
URL: https://github.com/apache/flink/pull/29120
## What is the purpose of the change
Update of SLF4J dependency to current version:
- makes dependency management easier for projects that build on Flink or use Logback
- prevents possible issues if a library Flink depends on starts using new SLF4J APIs
## Brief change log
Updated SLF4J 1.7.36 to 2.0.19. New version has compatible API, only Log4J binding must use a different dependency (`log4j-slf4j-impl` -> `log4j-slf4j2-impl`).
## Verifying this change
This change is already covered by existing tests.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): yes
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes - for deployments that replace logging libraries
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? docs
Update to Chinese documentation is fully AI-generated.
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change the checkbox below to `[X]` and replace the placeholder in the "Generated-by"
line with the tool name and version. Otherwise remove the "Generated-by" line.
See the ASF Generative Tooling Guidance for details:
https://www.apache.org/legal/generative-tooling.html
You are responsible for the quality and correctness of every change in this PR
regardless of the tooling used. Low-effort AI-generated PRs will be closed. See
AGENTS.md for the full guidance.
-->
- [x] Yes (please specify the tool below)
Generated-by: Claude Code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r4083395080
##########
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.19
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r3948236113
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -67,13 +66,13 @@ void testContextRestorationWorksWithNullContext() {
}
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);
}
Review Comment:
Retracting this suggestion, sorry for the noise. I decompiled `MDC.getMDCAdapter()` in 2.0.x and it's not a plain field read:
```
getstatic MDC_ADAPTER
ifnonnull -> return it
invokestatic getMDCAdapterGivenByProvider() // calls LoggerFactory.getProvider(), logs ERROR
// if none found, falls back to NOPMDCAdapter
putstatic MDC_ADAPTER // caches the fallback back into the static field
getstatic MDC_ADAPTER
```
If `MDC_ADAPTER` is still null when the test runs (plausible here, since flink-core doesn't bundle a real logging backend in test scope per the class javadoc), calling the public getter instead of reading the field directly would trigger a provider lookup, emit spurious ERROR-level log lines, and permanently cache a NOPMDCAdapter into the static field for the rest of the test JVM. The raw reflection read this PR already has avoids all of that, so it should stay as-is.
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -67,13 +66,13 @@ void testContextRestorationWorksWithNullContext() {
}
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);
}
Review Comment:
nit: since you're already touching this line for the field rename - `MDC.getMDCAdapter()` is public on both 1.7.36 and 2.0.19 (checked via javap), so the reflection here isn't needed for the getter, only for `setMDCAdapter` (which stays package-private).
```suggestion
private MDCAdapter getCurrentMDCAdapter() throws Exception {
return MDC.getMDCAdapter();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5796590948
Suggested release notes entry:
> Flink now uses SLF4J 2.0.20. Logging backends built for SLF4J 1.7 no longer work.
>
> - **Logback 1.2 is no longer supported**: users who replace Log4j 2 with Logback must upgrade to
> Logback 1.3 or later. With Logback 1.2 the cluster will start, but no log output will be produced.
> - **The SLF4J binding in `lib` has changed**: the distribution now ships
> `log4j-slf4j2-impl-2.26.1.jar` instead of `log4j-slf4j-impl-2.26.1.jar`.
> Update scripts, Dockerfiles and application JARs that refer to the old dependency.
>
> Users of Log4j 1 are affected as well: `org.slf4j:slf4j-log4j12` exists for SLF4J 1.7 only, so the
> `log4j:log4j` artifact can no longer be used. Use `ch.qos.reload4j:reload4j` with
> `org.slf4j:slf4j-reload4j` instead.
SLF4J 2.0.20 came out so I updated version in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r4083377473
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -50,10 +50,9 @@ void tearDown() throws Exception {
}
/**
- * 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 not fail, regardless of the backend in use.
Review Comment:
Replaced with custom adapter that explicitly throws on `setContextMap(null)`. I also renamed the test to be no longer Logback specific.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5811401143
Ok,. will post it today.
As for the _silently gone_ part, there will be a warning from SLF4J logged to stderr. After I start Flink with invalid bindings in lib/ directory:
```
jobmanager-1 | SLF4J(W): No SLF4J providers were found.
jobmanager-1 | SLF4J(W): Defaulting to no-operation (NOP) logger implementation
jobmanager-1 | SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
jobmanager-1 | SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
jobmanager-1 | SLF4J(W): Ignoring binding found at [jar:file:/opt/flink/lib/log4j-slf4j-impl-2.26.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
jobmanager-1 | SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "Samrat002 (via GitHub)" <gi...@apache.org>.
Samrat002 commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5573305471
Why not use the latest version 2.26.1?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser merged PR #29120:
URL: https://github.com/apache/flink/pull/29120
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r4064912529
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -50,10 +50,9 @@ void tearDown() throws Exception {
}
/**
- * 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 not fail, regardless of the backend in use.
Review Comment:
`BasicMDCAdapter.setContextMap(null)` is a no-op in SLF4J 2, so this passes with the `MdcUtils` null guard removed, and fails on the base. `Log4jMDCAdapter` still throws, so a null-rejecting adapter keeps the coverage.
##########
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.19
Review Comment:
`META-INF/licenses/LICENSE.slf4j-api` still carries the 2004-2017 copyright line, 2.0.19 ships 2004-2023.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r3948236113
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -67,13 +66,13 @@ void testContextRestorationWorksWithNullContext() {
}
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);
}
Review Comment:
Retracting this suggestion, sorry for the noise. I decompiled `MDC.getMDCAdapter()` in 2.0.x and it's not a plain field read:
```
getstatic MDC_ADAPTER
ifnonnull -> return it
invokestatic getMDCAdapterGivenByProvider() // calls LoggerFactory.getProvider(), logs ERROR
// if none found, falls back to NOPMDCAdapter
putstatic MDC_ADAPTER // caches the fallback back into the static field
getstatic MDC_ADAPTER
```
If `MDC_ADAPTER` is still null when the test runs (plausible here, since flink-core doesn't bundle a real logging backend in test scope per the class javadoc), calling the public getter instead of reading the field directly would trigger a provider lookup, emit spurious ERROR-level log lines, and permanently cache a NOPMDCAdapter into the static field for the rest of the test JVM. The raw reflection read this PR already has avoids all of that, so it should stay as-is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5572542330
Prefix and trailer added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-6128765436
@MartijnVisser will you be merging this for 2.4?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-XXXX] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5562362132
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "d48b40bde376e9499fc8a174aa2d57f20bed3c27",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "d48b40bde376e9499fc8a174aa2d57f20bed3c27",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* d48b40bde376e9499fc8a174aa2d57f20bed3c27 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on code in PR #29120:
URL: https://github.com/apache/flink/pull/29120#discussion_r3948205082
##########
flink-core/src/test/java/org/apache/flink/util/MdcLogbackCompatibilityTest.java:
##########
@@ -67,13 +66,13 @@ void testContextRestorationWorksWithNullContext() {
}
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);
}
Review Comment:
nit: since you're already touching this line for the field rename - `MDC.getMDCAdapter()` is public on both 1.7.36 and 2.0.19 (checked via javap), so the reflection here isn't needed for the getter, only for `setMDCAdapter` (which stays package-private).
```suggestion
private MDCAdapter getCurrentMDCAdapter() throws Exception {
return MDC.getMDCAdapter();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.19 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5573525656
Because this is about SLF4J, not Log4j
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "piotrp (via GitHub)" <gi...@apache.org>.
piotrp commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-6172272855
Updated release notes:
> Flink now uses SLF4J 2.0.20. Logging backends built for SLF4J 1.7 no longer work.
>
> - **Provided SLF4J version has changed**: the distribution now ships SLF4J 2.0.20.
> Update any pinned `slf4j-api` dependency that refers to version 1.7, especially in job JARs used in application mode or run on YARN.
> - **The SLF4J binding in `lib` has changed**: the distribution now ships
> `log4j-slf4j2-impl-2.26.1.jar` instead of `log4j-slf4j-impl-2.26.1.jar`.
> Update scripts, Dockerfiles and application JARs that refer to the old dependency.
> - **Logback 1.2 is no longer supported**: users who replace Log4j 2 with Logback must upgrade to
> Logback 1.5 or later. With Logback 1.2 the cluster will start, but no log output will be produced. Flink will log a warning to standard error.
>
> Users of Log4j 1 are affected as well: `org.slf4j:slf4j-log4j12` exists for SLF4J 1.7 only, so the
> `log4j:log4j` artifact can no longer be used. Use `ch.qos.reload4j:reload4j` with
> `org.slf4j:slf4j-reload4j` instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40574][build] Update SLF4J from 1.7.36 to 2.0.20 [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #29120:
URL: https://github.com/apache/flink/pull/29120#issuecomment-5801269230
@piotrp Thanks, both are fixed. Since this breaks existing setups, I think we need agreement on dev@ before it goes into a minor release. Can you start a [DISCUSS] thread? It should cover that in each of these cases the logs are silently gone:
- projects created from our quickstart archetype, until `log4j-slf4j-impl` is replaced by `log4j-slf4j2-impl`
- clusters running Logback 1.2 or Log4j 1
- jars in `lib/` that bundle `slf4j-api` 1.x
- connectors that pin SLF4J 1.7, once they build against 2.4
And the question whether we do this in 2.4 or wait for 3.0. 1.11 switched to Log4j 2 in a minor release too, but without breaking backwards compatibility: Log4j 1 kept working. The CVEs in Logback 1.2 are the main argument for 2.4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org