#35387 logging: make trace logging easily usable
https://github.com/bitcoin/bitcoin/pull/35387 · · +290/-41 in 11 files, 2 commits · labels: none
Goal
- Make trace logging usable without requiring paired debug flags
- Allow node operators to inspect and adjust log levels per category at runtime without restarting
This PR allows the -loglevel configuration option to function standalone without requiring accompanying -debug options to activate categories. It also introduces a new `loglevel` RPC that enables inspecting and adjusting logging levels (trace, debug, info) per category at runtime without restarting bitcoind.
Problem: Trace logging is difficult to discover and enable because -loglevel requires paired -debug flags to take effect. Furthermore, log severity thresholds cannot be modified dynamically at runtime, hindering debugging on live nodes.
Category: RPC / REST / ZMQ (#19 of 52)
P3 · new feature
- P3 because it lets node operators adjust category log levels dynamically at runtime
- Saves developers and node operators from restarting nodes during active debugging
P3 because it adds a new RPC method allowing node operators and developers to query and adjust log levels dynamically per category at runtime.
Membership: Adds the new loglevel RPC method and updates the existing logging RPC implementation.
Factors: security/stability 0, bug 0, performance 0, user value 2, leverage 0
Category: Utilities (logging, arguments, libraries) (#17 of 66)
P3 · user request
- P3 because it fixes unintuitive configuration where loglevel had no effect without debug
- Makes trace logging discoverable and straightforward to configure
P3 because it resolves an unintuitive logging configuration behavior where -loglevel was ineffective without -debug, making trace logs practically undiscoverable.
Membership: Changes logging arguments and internal Logger category/level mapping in src/logging.cpp and src/init/common.cpp.
Factors: security/stability 0, bug 1, performance 0, user value 2, leverage 1
Reviewability: Stale: Author silent
- Author silent for over 60 days, though CI passes and the branch has no conflicts
The author has been silent for 65 days, exceeding the 60-day stale inactivity threshold, though the branch has passing CI and no merge conflicts.
Author status: silent since 2026-07-14
Open concerns:
- stickies-v suggested deprecating the older `logging` RPC to avoid maintaining two parallel logging RPC endpoints.
- Potential conflict with or overlap against alternative pull request #34038.
Resolved concerns:
- Adopted MaybeArg helper in RPC parameter extraction as suggested by stickies-v.
Agreement: Positive
- Praised the new interface design as elegant and intuitive (stickies-v)
- Nonblocking suggestion to deprecate the older logging RPC to avoid maintaining both (stickies-v)
Positive feedback on interface design from stickies-v, who suggested deprecating the legacy logging RPC.
Reviewer stickies-v praised the design as elegant and intuitive while offering a nonblocking recommendation to deprecate `logging` in favor of `loglevel`.
- stickies-v: 'This looks like an elegant approach, I think it's an intuitive RPC and -loglevel interface.'
- stickies-v: 'I don't think we should have 2 parallel active logging RPC methods, so imo this PR should mark logging deprecated...'
Review verdicts (DrahtBot): 0
Files
104 lines under test/bench/ci.
- src/rpc/node.cpp +95/-19
- test/functional/feature_logging.py +100/-2
- src/init/common.cpp +44/-12
- doc/release-notes-35387.md +27/-0
- src/logging.cpp +14/-2
- src/logging.h +5/-6
- src/init.cpp +1/-0
- src/init/common.h +1/-0
- src/rpc/client.cpp +1/-0
- src/test/fuzz/rpc.cpp +1/-0
- src/test/logging_tests.cpp +1/-0
Card
This PR simplifies trace logging configuration by allowing the -loglevel argument to enable logging categories directly without requiring paired -debug arguments, and introduces a new loglevel RPC to adjust category log levels at runtime. It solves developer and operator friction when inspecting trace-level details on running nodes without needing a restart. Reviewer stickies-v found the approach elegant, though suggested deprecating the legacy logging RPC and pointed out the competing alternative in #34038. The PR is technically ready with green CI, but the author has been silent for over 60 days.