You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/09/10 23:45:00 UTC
[PR] use lazy slf4j placeholders instead of string interpolation [pekko-projection]
pjfanning opened a new pull request, #624:
URL: https://github.com/apache/pekko-projection/pull/624
### Motivation
Several slf4j call sites in main sources used the `s` string interpolator. In most of them the interpolator was inert — the only braces in the message were slf4j `{}` placeholders — so the prefix did nothing but mislead readers into thinking the arguments were already substituted. In `ReplicationImpl` the message was genuinely interpolated, so the string was built on every failed replication ask even when WARN was disabled.
### Modification
- Dropped the pointless `s` prefix in `EventProducerServiceImpl`, `JdbcOffsetStore` (2 sites) and `R2dbcOffsetStore` (2 sites).
- Converted the interpolated warn in `ReplicationImpl` to `log.warnN` with `{}` placeholders. `error` stays the trailing argument, which slf4j still resolves as the throwable because there are more arguments than placeholders.
Two nearby cases were deliberately left alone:
- `EventProducerServiceImpl` still builds its sources string eagerly via `map`/`mkString`, but that is a one-off at service construction on `info`, so a level guard would cost more than it saves.
- `ReplicationImpl` line 148 interpolates `s" on nodes with cluster role $role"` inside a `fold` — that is an argument *value*, not the template, so it cannot become a placeholder without restructuring the message.
### Result
Message arguments are only rendered when the level is enabled, and the call sites no longer mix interpolation with placeholder syntax. Rendered log output is unchanged. No signature or public API changes, so nothing MiMa-sensitive.
### Tests
- `sbt "grpc/compile" "jdbc/compile" "r2dbc/compile"` / success
- `sbt "grpc/scalafmt" "jdbc/scalafmt" "r2dbc/scalafmt"` / success
- No new test: behaviour-preserving logging refactor with identical rendered output and no signature changes
### References
None - drive-by cleanup of slf4j call sites in main sources
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] use lazy slf4j placeholders instead of string interpolation [pekko-projection]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #624:
URL: https://github.com/apache/pekko-projection/pull/624
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org