The logging RPC does not work as intended and as documented in its help when 0 or none are passed.
Per the RPC logging help:
0$ ./src/bitcoin-cli help logging
1
2In addition, the following are available as category names with special meanings:
3 - "all", "1" : represent all logging categories.
4 - "none", "0" : even if other logging categories are specified, ignore all of them.
The behavior and documentation were added in #11191, but over time and extended refactoring, the behavior no longer works in master and versions 22/23/24 (the last supported versions currently) – passing 0/none has no effect. As there was no test coverage, the regressions went uncaught. In v24, none became unrecognized:
0$ ./src/bitcoin-cli logging '["none"]'
1error code: -8
2error message:
3unknown logging category none
During the same time period, passing 1 and all has been operational and documented.
Solution: detect none/0 values and add test coverage in any case, and either:
-
leave the functionality out, raise with an error message if the values are passed, and update the RPC help documentation, or
-
fix the behavior by returning early.
Both solutions involve essentially the same code size and complexity. Given that all/1 has been operational, and that none/0 has been documented and appears per the code of the original PR to have been operational, it seems preferable for consistency to support none/0 in symmetry with all/1 and as ACKed, intended, and documented in #11191.
Done by this pull:
- add missing RPC logging logic and test coverage
- update the
-debugand-debugexcludeconfig options to use the same code for consistency in behavior between them, and for consistency with the logging RPC that provides the same behavior for both-includeand-exclude - improve the user-facing documentation and examples; can be tested with
./src/bitcoind -h | grep -A12 "\-debug=<\|debugexclude" && ./src/bitcoin-cli help logging
If it is decided to backport a fix, commit Fix RPC logging behavior when "0" and "none" values are passed could probably suffice.