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

full analysis

https://github.com/bitcoin/bitcoin/pull/34038 · ajtowns · +266/-132 in 16 files, 3 commits · labels: none

Goal

  • Make trace logging straightforward to configure at startup alongside debug logs
  • Allow node operators to dynamically inspect and toggle trace logging at runtime via RPC

Replaces the `-loglevel` command-line option with `-trace`, using syntax parallel to `-debug` so that `-trace=net` enables both debug and trace logs for the category. Also updates the `logging` RPC to accept a `trace` parameter and returns categorized arrays (`excluded`, `debug`, `trace`), retaining the old format under `-deprecatedrpc=logging`.

Problem: Trace logging was cumbersome to configure because `-loglevel=cat:trace` did nothing unless combined with `-debug=cat`, and category log levels could not be adjusted dynamically over RPC.

Category: Utilities (logging, arguments, libraries) (#18 of 66)

P3 · new feature

  • P3 because it eliminates a confusing pitfall where trace logging was silently ignored
  • Improves developer ergonomics and lays groundwork for wider trace logging adoption

Worthwhile developer ergonomics improvement for node logging. It removes a confusing pitfall where '-loglevel=net:trace' without '-debug' would silently do nothing, laying groundwork for broader trace logging adoption.

Membership: Changes logging configuration parsing in src/init/common.cpp and logging category management in src/logging.cpp/h.

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

Category: RPC / REST / ZMQ (#20 of 52)

P3 · new feature

  • P3 because it allows dynamic runtime control of trace logging without node restarts
  • Deprecation flags safely handle backward-incompatible changes to RPC output

Adds dynamic runtime trace log control over RPC without requiring a node restart. While breaking the existing RPC output format, it safely gates it behind a standard deprecation flag.

Membership: Modifies the logging RPC arguments and return structure in src/rpc/node.cpp.

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

Reviewability: Ready

  • Ready for review, with clean code and passing tests
  • An open design dispute over command-line flag syntax invites feedback

The code is clean, tests pass, and previous review comments have been addressed in code; only the high-level approach dispute remains.

Author status: Active; author maintains preference for this approach over #35387 and left the decision to project consensus.

Open concerns:

  • ryanofsky approach-NACKed, arguing that managing log levels across three interacting flags (-debug, -trace, -debugexclude) is confusing and breaks RPC backwards compatibility, advocating instead for a unified -loglevel key-value model implemented in #35387.
  • ajtowns and sedited prefer the current parallel -debug/-trace syntax over introducing a new key-value format for logging.

Resolved concerns:

  • Internal logging API refactors and STDLOCK thread annotations were split out into #34806 and #34809 and merged.
  • Backward-compatibility concerns around the logging RPC output were resolved by introducing the -deprecatedrpc=logging option.

Agreement: Disputed

  • Split on whether to use parallel flags or a unified key-value option
  • Support because the parallel startup flags are much easier to use (stickies-v, sedited)
  • Approach objection: interacting flags are confusing compared to a single option (ryanofsky)

Disputed: approved by stickies-v and sedited, but ryanofsky approach-NACKed in favor of #35387

Two contributors have tested and approved the PR, but ryanofsky posted an approach NACK favoring a single unified option in #35387. The author declined to adopt that design.

  • stickies-v approved (2026-04-02): 'The new -debug and -trace startup options are a lot easier to use... seems to be the best approach minimizing breaking changes.'
  • sedited approved (2026-05-11, re-ACK 2026-07-04): 'tACK 5b114839... I am fine with the changes here.'
  • ryanofsky approach NACK (2026-07-15): 'Concept ACK because making trace logging more accessible is a good goal, but approach NACK because having three options (-debug, -trace, -debugexclude) interact to control log levels is unnecessarily confusing... implemented an alternative in #35387.'
  • ajtowns (2026-08-09): 'I don't agree with @ryanofsky's criticisms... or accept majority opinion on the subjective ones if anyone is willing to offer opinions.'

Review verdicts (DrahtBot): 2 -1

Dependencies

Enables:

Files

File list not available for this run.

Card

This PR replaces the -loglevel argument with -trace (matching -debug syntax) and updates the logging RPC to support runtime configuration of trace-level categories. It solves a user pain point where setting trace levels was non-obvious and silently failed without combining with -debug. The PR has ACKs from stickies-v and sedited, but sits under an Approach NACK from ryanofsky, who prefers a unified key-value -loglevel interface as implemented in competing PR #35387. It was deferred from 32.0 to 33.x to resolve the design dispute.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T15:50, confidence high, input hash bdf2cde9fa61839d