#34038 logging: replace -loglevel with -trace, expose trace logging via RPC

ReviewabilityReviewsAgreementSize
#34038 ajtowns logging: replace -loglevel with -trace, expose trace logging via RPCReady0 (+2) -1Disputed172 + 94 tests
  • Fix silent failures when configuring trace logging and let node operators manage trace logs via RPC
  • Ready to review
  • Approach objection: three interacting flags are confusing and break RPC compatibility (ryanofsky)
  • Approach objection: setting trace as default while keeping specific categories at debug is impossible (ryanofsky)
  • Prefers alternative proposal in #35387 with unified -loglevel handling (ryanofsky)
  • Supports parallel flags as an easier startup interface despite unwieldy RPC interactions (stickies-v)
  • Tested and supports parallel flag design (sedited)
  • 172 lines added or modified outside tests
  • 94 lines added or modified in tests
  • 133 lines removed in total
  • 16 files, 3 commits
RPC / REST / ZMQ#24 of 55
P3 · new feature
  • P3 because it enables runtime inspection and toggling of trace-level logging via an administrative RPC
  • P3 because changing the return schema needs scrutiny but affects an admin rather than high-traffic endpoint
  • Ranking pass: Moved down 12: competing with #35387 on the same problem and admin-only in scope, so it ranks below the correctness fixes despite unblocking #35355.
Utilities (logging, arguments, libraries)#32 of 59
P3 · user request
  • P3 because it prevents -loglevel silently failing when -debug is omitted
  • P3 because confusing logging options degrade ergonomics but are noncritical and easily deferrable
  • Ranking pass: Lowered within band: the -loglevel confusion is real but competing proposal #35387 means a decision, not just review, is needed.
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Replaces the `-loglevel` startup and configuration option with `-trace`, allowing `-trace=<category>` to enable both debug and trace logging using syntax identical to `-debug`. Extends the `logging` RPC to accept a `trace` parameter and updates its return object to categorize log settings into `excluded`, `debug`, and `trace` string arrays, providing `-deprecatedrpc=logging` for backwards compatibility.

Problem: Configuring trace-level logging required combining `-debug=<category>` with `-loglevel=<category>:trace`, while specifying `-loglevel` alone silently had no effect. Additionally, node operators could not inspect or dynamically change trace-level logging at runtime via the `logging` RPC.

Evidence of importance:

  • Commit 2708138613 notes that previously 'trace logging for a category was enabled by saying "-debug=net -loglevel=net:trace" and saying "-loglevel=net:trace" (without "-debug" or "-debug=net") would silently do nothing.'
  • Release notes highlight that 'The -loglevel configuration option has been removed' and the 'logging RPC command is now able to switch trace level logs on and off, via its third parameter' while changing the output format.

Scope: Completely removes the `-loglevel` configuration argument in favor of `-trace`, and alters the default output schema of the `logging` RPC (retaining the old schema behind `-deprecatedrpc=logging`).

Risk of a mistake: medium (rpc_api, other). A breaking change to the logging RPC output schema and the removal of the -loglevel startup argument could disrupt external monitoring tools or configuration scripts.

Changed since the previous assessment: Added dedicated release notes documenting the removal of `-loglevel` and the `logging` RPC format change.

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • decision: decision on approach: this PR's interacting -trace flag model versus ryanofsky's unified -loglevel proposal in #35387 2026-08-21
  • decision: approach conflict between parallel flags (-debug/-trace) and unified -loglevel (#35387) 2026-08-21
  • reviewer: re-review after rebase in c:6363461488 2026-10-23

Agreement

Disputed

objection that needs a change, the objector pushed back after a reply (ryanofsky)

Thread notes: Re-classified ryanofsky's scope request as a suggestion (fixed by splitting PRs). Split ryanofsky's approach NACK into two parts (confusing interacting flags and impossible configurations), both marked contested following his pushback during milestone review. / Converted ryanofsky's scope objection to a suggestion, added part 2 to rc:2928796887 for stickies-v's suggestion on info terminology, and updated ryanofsky's approach NACK to contested following his pushback in c:5369066469.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
ryanofsky (member)suggestion, scopesplit the STDLOCK thread annotation change and backend changes into separate PRs to make review easierfixed · fix pushed · author split the changes into #34806 and #34809answeredyes2026-03-10: 'The STDLOCK thread annotation change might make sense as a separate PR so it could be easily reviewed by people familiar with thread safety annotations'
Status from: 2026-03-11: ajtowns: 'Split into #34806 (internal logging api refactors) and #34809 (STDLOCK).'
stickies-v (member)objection, interfaceordering and interactions between debug, trace, and exclude arguments create unnecessary RPC interface complexityaccepted · stickies-v accepted that breaking changes should be minimized and dropped the requestansweredyes2026-03-13: 'We have quite a bit of complexity wrt interface (documentation), implementation, and tests to deal with the interactions and ordering of these `debug`, `trace`, `exclude` options.'
Status from: 2026-04-02: stickies-v: 'Fair, not all breaking changes are equally breaking, and I agree we should properly weigh the impact this has on users.'
stickies-v (member)suggestion, interfaceuse 'info' instead of 'disabled' or 'excluded' language for categories with debug/trace turned offaccepted · accepted author declining to adopt info terminologyansweredyes2026-03-13: 'Orthogonally, I think it also wouldn't be unreasonable to just use "info" instead of "disable{d}"/"excluded" language.'
Status from: 2026-04-02: stickies-v: 'Anyway, I understand you don't want to make this change here.'
ryanofsky (member)objection, approachhaving three interacting options (-debug, -trace, -debugexclude) to control log levels is unnecessarily confusing when a single option should cover itcontested · ryanofsky reiterated the approach NACK in response to milestone discussionchangedyes2026-07-15: 'approach NACK because having three options (`-debug`, `-trace`, `-debugexclude`) interact to control log levels is unnecessarily confusing when a single option should cover it.'
Status from: 2026-08-21: ryanofsky: 'The approach this PR takes to resolve the issue is also confusing and breaks RPC compatibilty and there is a simpler approach without these drawbacks in #35387 that should be considered and evaluated.'
ryanofsky (member)objection, interfaceimpossible to configure trace as default while keeping specific categories at debug because -trace=all overrides per-category -debugcontested · ryanofsky reiterated the approach NACK in response to milestone discussionchangedyes2026-07-15: 'That last point makes some reasonable configurations impossible: you can't set trace as the default log level while keeping specific categories at debug, because any per-category `-debug=<cat>` will be overridden by `-trace=all`.'
Status from: 2026-08-21: ryanofsky: 'The approach this PR takes to resolve the issue is also confusing and breaks RPC compatibilty and there is a simpler approach without these drawbacks in #35387 that should be considered and evaluated.'

Support:

  • stickies-v (member) (Concept ACK, 2025-12-10) [read: -loglevel, BCLog::NO_RATE_LIMIT]: Both the new `BCLog::NO_RATE_LIMIT` and `-loglevel` changes make for a more natural and ergonomic interface for both developers and users, and the changes required are limited enough.
  • stickies-v (member) (ACK, 2026-04-02) [read: -debug, -trace, RPC, rpc]: The new `-debug` and `-trace` startup options are a lot easier to use, and although I think the RPC interface is getting increasingly unwieldy, this seems to be the best approach minimizing breaking changes to expose the trace level there too.
  • sedited (member) (Tested ACK, 2026-05-11) [tested]: tACK 5b114839c24f2298cd57c3d724f85f39400d6832 [not substantive]

Participants:

  • stickies-v (member, support, 49 statements 2025-12-10 to 2026-07-04): ACKed after earlier concerns about PR scope and RPC interface complexity were resolved
  • abo-L (none, neutral, 1 statements 2025-12-15 to 2025-12-15): posted a Bitcoin address
  • ryanofsky (member, objection, 6 statements 2026-03-10 to 2026-08-21): approach NACK advocating for a unified -loglevel model in #35387 instead of interacting flags
  • sedited (member, support, 4 statements 2026-05-11 to 2026-08-09): tested ACK and agreed with the current parallel flag design
  • maflcko (member, neutral, 2 statements 2026-08-21 to 2026-08-21): process inquiry, moved PR milestone from 32.0 to 33.x

Dependencies

Enables:

Base for: #35355

Files

153 lines under test/bench/ci.

  • src/rpc/node.cpp +74/-20
  • test/functional/feature_logging.py +37/-22
  • src/logging.cpp +48/-5
  • src/test/logging_tests.cpp +29/-24
  • src/init/common.cpp +18/-27
  • test/functional/rpc_misc.py +21/-8
  • src/logging.h +12/-14
  • doc/release-notes-34038.md +13/-0
  • doc/developer-notes.md +4/-5
  • test/functional/test_framework/test_node.py +4/-1
  • src/bench/logging.cpp +2/-2
  • src/test/util/setup_common.cpp +1/-2
  • src/rpc/client.cpp +2/-0
  • src/wallet/sqlite.cpp +1/-1
  • src/init.cpp +0/-1
  • src/init/common.h +0/-1

Card

The short text the ranking pass compares across PRs.

Replaces the -loglevel configuration option with -trace and exposes trace logging controls in the logging RPC. Previously, enabling trace logging required using both -debug and -loglevel options together because -loglevel alone silently did nothing, and trace logging could not be toggled at runtime via RPC. The logging RPC now supports a trace parameter and groups categories into excluded, debug, and trace arrays, preserving legacy output format under -deprecatedrpc=logging. PR #35355 builds on top of this change.

Data

dossier JSON · extract JSON · model ledger, generated 2026-10-25T01:14, confidence high, input hash 4b2c86ef6794c676
thread read through 2026-10-23 (88 statements), head 649b0503ad
labels: none

Categories

RPC / REST / ZMQ

P3 · new feature (ranking pass: Moved down 12: competing with #35387 on the same problem and admin-only in scope, so it ranks below the correctness fixes despite unblocking #35355.)

Extending the logging RPC allows dynamic runtime inspection and toggling of trace-level logging, but alters the return schema requiring a deprecation path. While breaking changes to RPC output require reviewer scrutiny under RPC compatibility criteria, the logging endpoint is an administrative tool rather than a hot method used by downstream application infrastructure.

Membership: Updates src/rpc/node.cpp to accept a trace parameter in the logging RPC and alters its return object format, introducing a deprecation flag.

Factors: security/stability 0, bug 1, performance 0, user value 2, leverage 1

Utilities (logging, arguments, libraries)

P3 · user request (ranking pass: Lowered within band: the -loglevel confusion is real but competing proposal #35387 means a decision, not just review, is needed.)

Resolves confusing logging configuration behavior where -loglevel alone would silently fail without -debug. Within the utilities rubric, addressing confusing logging options is explicitly valued, though the issue is not critical to node operation and is reasonably deferrable.

Membership: src/logging.cpp and src/init/common.cpp changes overhaul logging options and configuration handling by replacing -loglevel with -trace.

Factors: security/stability 0, bug 1, performance 0, user value 2, leverage 1