Skip to content

BP-69: Convert stream/distributedlog modules to slog (phase 5)#4757

Merged
merlimat merged 3 commits intoapache:masterfrom
merlimat:bp-69-slog-stream
Apr 28, 2026
Merged

BP-69: Convert stream/distributedlog modules to slog (phase 5)#4757
merlimat merged 3 commits intoapache:masterfrom
merlimat:bp-69-slog-stream

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

Summary

Part of BP-69 (SLF4J to slog migration). Converts the stream/distributedlog/* and stream/* modules to use slog for structured logging.

Stacked with (but independent of) #4754 / #4755 / #4756 — includes the same minimal base scaffolding commit:

  1. BP-69 base: add slog dependency and LICENSE entries — adds slog to root pom.xml, updates LICENSE-*.bin.txt files, and adds lombok.config for the @CustomLog annotation.
  2. BP-69: Convert stream module from SLF4J to slog — the actual module conversion (213 files).

Scope

Modules converted:

  • stream/bk-grpc-name-resolver
  • stream/clients/java/{all,base,kv}
  • stream/common
  • stream/distributedlog/{common,core,io/dlfs,protocol}
  • stream/server
  • stream/statelib
  • stream/storage/impl
  • stream/tests-common

Conversion patterns applied

  • LoggerFactory.getLogger(Foo.class) / @Slf4j → Lombok @CustomLog generating a slog Logger.
  • log.info("text {} {}", a, b)log.info().attr("nameA", a).attr("nameB", b).log("text") — values become typed structured attributes.
  • log.error("msg", exception)log.error().exception(exception).log("msg").
  • Consistent attribute naming: ledgerId, entryId, streamId, rangeId, logSegment, storageContainer, routingKey, etc.
  • Removed placeholder-removal artifacts (dangling prepositions, gap punctuation, trailing colons).

No changes to log output format — slog with the SLF4J backend produces equivalent output.

Test plan

  • mvn -pl stream/... compile passes
  • mvn -pl stream/... checkstyle:check passes
  • Full CI matrix green

Minimal scaffolding commit for the BP-69 slog migration series:

- Add `io.github.merlimat.slog:slog:0.9.7` to the root pom.xml
  dependencyManagement and to the global compile classpath alongside
  the existing SLF4J API (which stays as the rendering backend).
- Add lombok.config at the repo root so `@CustomLog` generates a slog
  `Logger` instead of an SLF4J one.
- Register the slog jar in LICENSE-all.bin.txt, LICENSE-server.bin.txt
  and LICENSE-bkctl.bin.txt so the CI check-binary-license script
  finds it accounted for in the bundled-jars list.

No actual Java file is converted in this commit. Individual module
migrations stack on top of this one.
Pulls in the MDC propagation fix from merlimat/slog#6, which makes
log4j2 ThreadContext entries visible on slog events emitted via the
Log4j2Logger backend (so %X{key} layouts and appenders that read
event.getContextData().getValue(key) see the caller's MDC).
@merlimat merlimat merged commit 51abbc2 into apache:master Apr 28, 2026
78 of 86 checks passed
@merlimat merlimat deleted the bp-69-slog-stream branch April 28, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants