Categories in the logging system currently work as follows:
- You can set a global log level (defaulting to
debug
), totrace
to enable trace logs in all (enabled) categories (-loglevel=trace
), or toinfo
to disable debug logs even enabled categories (-debug=all -loglevel=info
will still leave debugging disabled) - You can override the global log level on a per-category basis, either making it more verbose (override info to debug or trace, or override debug to trace), or to make it less verbose (override a global default of debug or trace to a category specific level of info or debug), eg
-loglevel=walletdb:trace -loglevel=net:info
- The log levels are only relevant for “enabled” categories (eg, you have to specify
-debug=walletdb -loglevel=walletdb:trace
to enable wallet db tracing) - Enabling/disabling categories can be done at startup via the
-debug
option, or at runtime via thelogging
RPC - Setting the log level is currently only possible at startup via the (currently hidden)
-loglevel
option
Is this behaviour worth preserving, or can we simplify it? I think it would be simpler and almost as powerful if we set things up as:
- Every category has a log level, that can be either
info
(default),debug
, ortrace
(trace gives you everything, debug gives you everything butLogTrace()
, and info skips bothLogDebug()
andLogTrace()
) - We add a new
-trace
config option that sets a category’s log level to trace, analogously to-debug
(so you would just specify-trace=walletdb
for wallet db tracing. - We add an optional third argument to the
logging
rpc that accepts a list of categories to enable trace logging - We support
-debug=all
or-trace=all
to do all categories at once, and-debug=all -debugexclude=leveldb
as usual to set all categories to debug but one left at info, or-trace=all -debug=walletdb
to trace all categories but one left at debug (which offer similar behaviour to-debug=all -loglevel=debug -loglevel=leveldb:info
or-debug=all -loglevel=trace -loglevel=walletdb:debug
)
(Looking for concept acks/feedback)