Skip to content

refactor(client): use SLF4J parameterized logging instead of string concatenation#19155

Merged
voonhous merged 3 commits into
apache:masterfrom
voonhous:cleanup-slf4j-log-templating-hudi-client
Jul 5, 2026
Merged

refactor(client): use SLF4J parameterized logging instead of string concatenation#19155
voonhous merged 3 commits into
apache:masterfrom
voonhous:cleanup-slf4j-log-templating-hudi-client

Conversation

@voonhous

@voonhous voonhous commented Jul 3, 2026

Copy link
Copy Markdown
Member

Describe the issue this Pull Request addresses

Many hudi-client log statements build their message with + string concatenation instead of SLF4J {} placeholders. This is the first batch of a broader logging cleanup.

Summary and Changelog

Convert +-concatenated log messages to SLF4J parameterized {} logging across hudi-client (client-common, java-client, spark-client, flink-client) - 132 call sites in 67 files.

  • Each concatenated expression becomes a placeholder argument, in order.
  • A trailing throwable is kept as the last argument, so stack traces are still logged.
  • Multi-line concatenations collapse to a single {} message; 3 long ones were re-wrapped to stay within the 200-char line limit.

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. Only provably-safe rewrites were applied (leading-arithmetic and brace-collision cases were skipped and handled by hand). Verified with mvn test-compile on client-common + java-client (JDK 17) and checkstyle:check across all four submodules.

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

@github-actions github-actions Bot added the size:M PR with lines of changes in (100, 300] label Jul 3, 2026
@voonhous voonhous changed the title refactor(client): use SLF4J parameterized logging instead of string c… refactor(client): use SLF4J parameterized logging instead of string concatenation Jul 3, 2026
@voonhous voonhous force-pushed the cleanup-slf4j-log-templating-hudi-client branch from 93db838 to 16ded7c Compare July 3, 2026 11:47

@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 log messages to SLF4J parameterized {} logging across the hudi-client modules, with placeholder counts matching arguments and trailing throwables preserved so stack traces are emitted unchanged. 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 few spots still call .toString() on the argument being passed to a {} placeholder, which partially defeats the lazy-evaluation benefit this PR is restoring — otherwise the changes look clean.

cc @yihua

voonhous added a commit to voonhous/hudi that referenced this pull request Jul 3, 2026
With {} templating SLF4J calls toString() lazily on the argument, so the
explicit calls were redundant. Removed in TimelineArchiverV1,
HoodieCompactionPlanGenerator and the matching TestLegacyArchivedMetaEntryReader
log. Addresses review nits on apache#19155.

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 SLF4J calls toString() lazily on the argument, so the
explicit calls were redundant. Removed in TimelineArchiverV1,
HoodieCompactionPlanGenerator and the matching TestLegacyArchivedMetaEntryReader
log. Addresses review nits on apache#19155.
@voonhous voonhous force-pushed the cleanup-slf4j-log-templating-hudi-client branch from 155f39e to c8a0145 Compare July 3, 2026 12:19

@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 converts string-concatenated log statements to SLF4J parameterized {} logging across the hudi-client modules, and the traced call sites show placeholder counts matching their arguments with trailing throwables preserved for stack traces. 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. The conversion from string concatenation to SLF4J parameterized logging is clean throughout — one spot in HoodieBinaryCopyHandle where collapsing two lines into one made the log statement unwieldy.

cc @yihua

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

Convert `+`-concatenated log messages to SLF4J `{}` placeholders across
hudi-client (client-common, java-client, spark-client, flink-client).

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 SLF4J calls toString() lazily on the argument, so the
explicit calls were redundant. Removed in TimelineArchiverV1,
HoodieCompactionPlanGenerator and the matching TestLegacyArchivedMetaEntryReader
log. Addresses review nits on apache#19155.

@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 the hudi-client modules, and the conversions check out — placeholder counts match their argument counts and trailing Throwable arguments remain unmatched so stack traces are preserved. 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 few dozen clean mechanical conversions — just one spot where collapsing a multi-line concat into a single long parameterized call hurt readability.

cc @yihua

Keep the format string and its arguments on separate lines in
HoodieBinaryCopyHandle.write() instead of one ~200-char line, per review.

@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 log statements to SLF4J parameterized {} logging across the hudi-client modules, preserving placeholder/argument counts and trailing-throwable semantics so stack traces still print. 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

@voonhous

voonhous commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

@wombatu-kun Can i get a re-review on this mechanical PR, thanks.

@voonhous voonhous merged commit 865a554 into apache:master Jul 5, 2026
71 checks passed
@voonhous voonhous deleted the cleanup-slf4j-log-templating-hudi-client branch July 5, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M PR with lines of changes in (100, 300]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants