BP-69: Adopt slog for structured logging#4751
Open
merlimat wants to merge 1 commit intoapache:masterfrom
Open
Conversation
Proposal to migrate BookKeeper from SLF4J to the slog structured-logging library (mirroring Pulsar PIP-467), and to add a public client API method withLoggerContext(Map<String, Object>) on CreateBuilder/OpenBuilder/ DeleteBuilder so callers can attach their own logging context attributes to a ledger Handle. Retires the existing bookkeeper-slogger module (5 internal call sites, no external adoption). Tracking issue: apache#4750
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR adds BP-69: Adopt slog for structured logging for discussion.
BookKeeper currently uses SLF4J with unstructured
{}-style format strings. This makes logs hard to query in modern log backends (Loki, Elastic, Splunk, etc.), forces every call site to restate identity context (ledgerId, bookieId, entryId, …) inline, and requiresisDebugEnabled()guards on hot paths to avoidString.format/toStringcost.Apache Pulsar PIP-467 reached the same conclusion, chose the slog library, and its migration is complete. Because Pulsar is BookKeeper's largest user, a shared logging substrate lets cross-project debugging chains stay structured end-to-end.
The BP also covers retiring the existing
bookkeeper-sloggermodule (only 5 main-source files use it, all inbookkeeper-server), and adds an API for callers to attach their own context attributes to a ledgerHandleviawithLoggerContext(Map<String, Object>)onCreateBuilder/OpenBuilder/DeleteBuilder— so e.g. Pulsar'smanagedLedger=<topic>attribute can appear automatically on BookKeeper client log lines without BookKeeper knowing about Pulsar concepts.Tracking issue: #4750
Summary
site3/website/src/pages/bps/BP-69-slog-structured-logging.mdUnder Discussioninsite3/website/src/pages/community/bookkeeper-proposals.mdTest plan