Skip to content

Commit c25bad6

Browse files
committed
Create a logging doc
1 parent 8d9a3c9 commit c25bad6

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
- [IRC channels.](irc-channels.txt) Join these IRC channels for Bitcoin and
1515
Lightning development.
1616

17+
- [Logging.](logging.md) How to read and set bitcoind debug logging, with
18+
descriptions of each log category.
19+
1720
- [Notes.](notes.txt) Various miscellaneous technical notes.
1821

1922
- [Gitian Building.](gitian-building.md) How to build and commit Gitian

logging.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Logging
2+
3+
Last updated: September 12, 2021
4+
5+
## How to configure bitcoind debug logging
6+
7+
### On node startup
8+
9+
Logging can be configured on bitcoind startup with the `-debug=` option.
10+
11+
For example, `bitcoind -debug=lock -debug=i2p` on the command line will turn on
12+
logging of lock contentions and I2P information in the debug log.
13+
14+
The same options can be used in the `bitcoin.conf` file without the leading
15+
hyphen and with one command per line:
16+
17+
debug=lock
18+
debug=i2p
19+
20+
### On a running node
21+
22+
Logging can be read and set on a running instance of bitcoind using the
23+
logging RPC:
24+
25+
bitcoin-cli logging
26+
bitcoin-cli help logging
27+
28+
#### Examples
29+
30+
To turn on debug=net:
31+
32+
bitcoin-cli logging '["net"]'
33+
34+
To turn off debug=net:
35+
36+
bitcoin-cli logging [] '["net"]'
37+
38+
To turn on debug=all:
39+
40+
bitcoin-cli logging '["all"]'
41+
42+
To turn off all debug logging:
43+
44+
bitcoin-cli logging [] '["all"]'
45+
46+
47+
## Log categories
48+
49+
Here are the log categories and a description of each. This is an updated
50+
version of this [Bitcoin Stack Exchange
51+
answer](https://bitcoin.stackexchange.com/questions/66892/what-are-the-debug-categories/66895#66895)
52+
in 2017 by Andrew Chow.
53+
54+
addrman: Address Manager. Messages about the status of the address
55+
manager and when addresses are added or removed from the address
56+
manager database.
57+
58+
bench: Messages about the benchmark performance of various parts of
59+
the software that can have performance issues.
60+
61+
cmpctblock: Messages about the Compact Blocks relay protocol,
62+
including when blocks are partially downloaded or reconstructed.
63+
64+
coindb: Coin Database. Messages about the coin database which contains
65+
the UTXO set, including messages about database flushes and writes.
66+
67+
estimatefee: Messages about the fee estimation algorithm, including
68+
messages about when fee estimates are requested and information about
69+
the status of the fee estimator.
70+
71+
http: Messages related to the HTTP server that is used to handle the
72+
RPC requests. These messages will typically be for the startup and
73+
shutdown of the server as well as received requests.
74+
75+
i2p: All messages related to using the I2P privacy network.
76+
77+
ipc: All requests and responses between processes. See
78+
[doc/multiprocess.md](https://github.com/bitcoin/bitcoin/blob/master/doc/multiprocess.md).
79+
80+
libevent: Messages from the libevent library used for the HTTP server.
81+
82+
libevent: Messages from the libevent library used for the HTTP server.
83+
84+
lock: All lock contentions and their duration.
85+
86+
mempool: Messages related to actions done in the memory pool, most
87+
frequently transaction acceptance (`AcceptToMemoryPool`). Also
88+
includes transaction removals.
89+
90+
mempoolrej: Messages about transactions rejected from the memory pool.
91+
92+
net: All messages related to communicating with other nodes on the
93+
network, including what P2P messages were sent and received and to
94+
whom and other information about the network messages.
95+
96+
proxy: Messages about using a SOCKS5 proxy and its authentication.
97+
98+
prune: Messages about local blockchain pruning, including the result
99+
of a pruning operation.
100+
101+
qt: Messages about Qt, the GUI framework.
102+
103+
rand: Messages for when randomness is needed by any function.
104+
105+
reindex: Messages about the reindexing process, in particular errors
106+
about out-of-order blocks and repeated blocks.
107+
108+
rpc: Messages about the RPC server, including its startup and shutdown
109+
as well as when commands are issued.
110+
111+
selectcoins: Coin Selection. Messages about the UTXOs that are
112+
selected when sending money.
113+
114+
tor: All messages related to using a TOR SOCKS5 proxy and TOR hidden
115+
service (used for receiving incoming connections over TOR). This
116+
includes messages about the creation and shutdown of the TOR hidden
117+
service and messages about the connection to the TOR proxy.
118+
119+
validation: All messages related to the validation interface, most
120+
frequently `TransactionAddedToMempool` and `stored orphan tx`.
121+
122+
walletdb (db in v.0.19 and earlier): Messages about the status of the
123+
Berkeley Database engine used for the wallet database, including
124+
messages about database flushes.
125+
126+
zmq: Messages about the ZeroMQ notification system, including the
127+
startup and shutdown of the service as well as when notifications are
128+
issued and new clients connected.
129+
130+
This is not an exhaustive list of the types of messages you will see for each
131+
category. Also, some categories have many possible messages whilst others have
132+
very few.

0 commit comments

Comments
 (0)