Skip to content

BP-69: Convert http, tools, benchmark and metadata-drivers to slog (phase 4+6)#4758

Open
merlimat wants to merge 3 commits intoapache:masterfrom
merlimat:bp-69-slog-misc
Open

BP-69: Convert http, tools, benchmark and metadata-drivers to slog (phase 4+6)#4758
merlimat wants to merge 3 commits intoapache:masterfrom
merlimat:bp-69-slog-misc

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

Summary

Part of BP-69 (SLF4J to slog migration). Converts the remaining peripheral modules to use slog for structured logging.

Stacked with (but independent of) #4754 / #4755 / #4756 / #4757 — each includes the same minimal BP-69 base scaffolding commit, so this PR can merge independently.

Scope

Modules converted (45 files total):

  • bookkeeper-http/* (5 files) — http-server, vertx-http-server, servlet-http-server
  • tools/* (21 files) — ledger, framework, stream CLI, perf (journal / table / dlog)
  • bookkeeper-benchmark (4 files) — TestClient, BenchThroughputLatency, BenchReadThroughputLatency, BenchBookie
  • metadata-drivers/etcd (15 files) — all etcd driver classes plus the vendored io.etcd.jetcd.impl.EtcdConnectionManager

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"); .exceptionMessage(e) used where only e.getMessage() was consumed.
  • if (log.isDebugEnabled()) { log.debug(...) }log.debug(e -> e.attr(...).log(...)) lambda form (zero-overhead when disabled).
  • Short form log.info("simple") preserved when there are no attrs.
  • Consistent attribute naming: ledgerId, bookieId, streamId, rangeId, path, key, revision, leaseId, cookiePath, watchId, throughput, latencyMs, etc. — no single-letter or generic argN keys.

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

Test plan

  • mvn compile passes on all touched modules
  • mvn checkstyle:check passes on all touched modules
  • 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).
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