Skip to content

refactor(flink): use SLF4J parameterized logging instead of string concatenation#19156

Merged
voonhous merged 2 commits into
apache:masterfrom
voonhous:cleanup-slf4j-log-templating-flink-datasource
Jul 4, 2026
Merged

refactor(flink): use SLF4J parameterized logging instead of string concatenation#19156
voonhous merged 2 commits into
apache:masterfrom
voonhous:cleanup-slf4j-log-templating-flink-datasource

Conversation

@voonhous

@voonhous voonhous commented Jul 3, 2026

Copy link
Copy Markdown
Member

Describe the issue this Pull Request addresses

Many hudi-flink-datasource log statements build their message with + string concatenation instead of SLF4J {} placeholders. Follow-up to #19155 (same cleanup for hudi-client).

Summary and Changelog

Convert +-concatenated log messages to SLF4J parameterized {} logging across hudi-flink-datasource - 34 call sites in 22 files (hudi-flink plus the flink1.18.x-2.1.x version modules).

  • Each concatenated expression becomes a placeholder argument, in order.
  • A trailing throwable is kept as the last argument, so stack traces are still logged.

No code was copied. Behaviour-preserving - no functional change.

Impact

None (logging only). Minor perf benefit: the message string is no longer built eagerly when the log level is disabled.

Risk Level

low - mechanical, behaviour-preserving change, identical in shape to the compile-verified hudi-client batch (#19155). Verified here with checkstyle:check on hudi-flink; no line exceeds the 200-char limit.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@voonhous voonhous changed the title refactor(flink): use SLF4J parameterized logging instead of string co… refactor(flink): use SLF4J parameterized logging instead of string concatenation Jul 3, 2026

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR mechanically converts +-concatenated log messages to SLF4J parameterized {} logging across hudi-flink-datasource. I checked placeholder/argument counts and the trailing-throwable handling on the log.error(...) calls — the throwable arguments are correctly left as the last (unmatched) argument so stack traces are preserved, and all multi-placeholder messages line up with their arguments. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. A couple of pre-existing message format oddities worth cleaning up while these lines are being touched.

cc @yihua

voonhous added a commit to voonhous/hudi that referenced this pull request Jul 3, 2026
With `{}` templating, "Error ?{}" reads oddly (the `?` looks like a stray
ternary fragment). Reword to "Error: {}" in both the clustering job and
compactor graceful-shutdown logs. Addresses review nit on apache#19156.

Claude-Session: https://claude.ai/code/session_01FpDcDnw5gVVKBfPeEqJ3Fk
voonhous added a commit to voonhous/hudi that referenced this pull request Jul 3, 2026
With `{}` templating, "Error ?{}" reads oddly (the `?` looks like a stray
ternary fragment). Reword to "Error: {}" in both the clustering job and
compactor graceful-shutdown logs. Addresses review nit on apache#19156.
@voonhous voonhous force-pushed the cleanup-slf4j-log-templating-flink-datasource branch from 49244c9 to 28451c4 Compare July 3, 2026 12:19
@github-actions github-actions Bot added the size:S PR with lines of changes in (10, 100] label Jul 3, 2026

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR mechanically converts +-concatenated Flink log statements to SLF4J parameterized {} logging across 22 files. I traced the placeholder-to-argument counts and the trailing-throwable cases (the common SLF4J pitfall) and they all line up correctly — the throwables remain trailing args so stack traces are preserved. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.

cc @yihua

voonhous added 2 commits July 4, 2026 02:36
…ncatenation

Convert `+`-concatenated log messages to SLF4J `{}` placeholders across
hudi-flink-datasource (hudi-flink and the flink1.18.x-2.1.x version modules).

The rewrite is behaviour-preserving: each concatenated expression becomes a
placeholder argument in order, and a trailing throwable is kept as the last
argument so its stack trace is still recorded. This also avoids building the
message string eagerly when the log level is disabled.
With `{}` templating, "Error ?{}" reads oddly (the `?` looks like a stray
ternary fragment). Reword to "Error: {}" in both the clustering job and
compactor graceful-shutdown logs. Addresses review nit on apache#19156.

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for the contribution! This PR mechanically converts +-concatenated Flink log statements to SLF4J parameterized {} logging across 22 files. I traced each converted site, paying particular attention to placeholder/argument counts and the error-with-throwable cases (where the trailing Throwable must remain unmatched by a placeholder so SLF4J logs the stack trace) — those all check out. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.

cc @yihua

@hudi-bot

hudi-bot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants