ajtowns
commented at 12:56 AM on May 22, 2026:
contributor
Followup of #28318, #34038, and #34806 to simplify and optimize the logging-disabled path for LogTrace().
Removes the global log level (m_log_level) and the unordered_map from category to level (m_category_log_levels) in favour of a single atomic<uint64_t> m_trace_categories, and reduces ShouldDebugLog and ShouldTraceLog to lock-free checks on a single atomic. Also makes Enabled() lock-free, to waste a little less time in the case where debugging is completely disabled.
Does a bit of clean up as well:
guards m_file_path and provides accessors
makes other configuration variables atomic, rather than "write-before-createing-threads-then-treat-as-read-only"
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
LLM Linter (✨ experimental)
Possible typos and grammar issues:
values indicates its status -> values indicate its status [subject-verb agreement; the current phrasing is grammatically incorrect]
<sup>2026-05-22 03:12:38</sup>
ajtowns
commented at 1:00 AM on May 22, 2026:
contributor
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. Simplify this so that
"-debug=net" enables debug logging for net and "-trace=net" enables
both debug and trace logging for net.
Note that "-nodebug" and "-notrace" only disable previous "-debug=xxx" and
"-trace=yyy" arguments, so "-debug=mempool -trace=net -nodebug" will cancel
"-debug=mempool", but will still include both debug and trace logs for net.
d8b6710a03
rpc: Update logging RPC to support trace level debugging
Also changes the output format, to distinguish debug/trace levels.
Provides `-deprecatedrpc=logging` if old output format is needed.
Co-Authored-By: stickies-v <stickies-v@protonmail.com>
7af81b5d38
[doc] Release notes for user-visible logging changes77ac0f81cd
logging: replace global and category log levels with atomic int
Since we have reduced how much log levels can be configured (error,
warning and info are always logged; and only debug and trace levels can
be disabled), we only need two bits per category to store the information.
We can do this with two atomic ints, one for whether -debug is enabled,
and the other for whether -trace is enabled.
This allows `WillLogCategoryLevel` to avoid taking a mutex, potentially
allowing for better performance in the event that multiple threads are
running many LogDebug(..) statements over categories that do not have
-debug enabled (or LogTrace/-trace).
810352a390
logging: Make sure BCLog::Logger members are atomic or guarded5431316967
logging: Make Enabled() lock-free
Add m_any_print_callbacks as a cache for !m_print_callbacks.empty(),
and make m_buffered atomic. Makes the Log functions almost completely
free when logging is completely disabled (though unlike for LogDebug
when the category is disabled, arguments are still evaluated).
787f095f0c
[move-only] logging: Move Logger member variables togetherb9b9d8ca33
logging: Drop unused SetCategoryLogLevel(str,str)4f259fd04c
logging: Replace Enable/Trace/DisableCategory(str) with SetCategoryLogLevel(str, level)60dacd0db5
logging: Drop Enable/Trace/DisableCategory aliases52f90febd5
logging: Drop WillLogCategory* in favour of Logger::ShouldDebugLog and ShouldTraceLog84dc8e4223
util/log.h: Move internal functions into detail namespace10e63dbb62
ajtowns force-pushed on May 22, 2026
DrahtBot added the label CI failed on May 22, 2026
DrahtBot removed the label CI failed on May 22, 2026
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-05-22 22:51 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me