Skip to content

Commit fad257e

Browse files
committed
logging: switch to a simple ringbuffer.
We keep a history of logs internally, so we can drop them to disk on a crash. This "black box recorder" was some of the first code I wrote for CLN, but I can't remember the last time we use a crash log to diagnose a problem. We attempt to prune it to keep it under 10MB, but the complexity and cost is rarely worth it: simplify it to use a ringbuffer. Changelog-Changed: lightningd: logging is now more efficient internally (no more pruning, simple ringbuffer). ``` 139993 DEBUG lightningd: fixup_scan: block 786151 with 1203 txs ===> 55388 DEBUG plugin-bcli: Log pruned 1001 entries (mem 10508118 -> 10298662) 33000 DEBUG gossipd: Unreasonable timestamp in 0102000a38ec41f9137a5a560dac6effbde059c12cb727344821cbdd4ef46964a4791a0f67cd997499a6062fc8b4284bf1b47a91541fd0e65129505f02e4d08542b16fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000d9d56000ba40001690fe262010100900000000000000001000003e8000001f30000000000989680 23515 DEBUG hsmd: Client: Received message 14 from client 22269 DEBUG 024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605-hsmd: Got WIRE_HSMD_ECDH_REQ 14409 DEBUG gossipd: Enqueueing update for announce 0102002f7e4b4deb19947c67292e70cb22f7fac837fa9ee6269393f3c513d0431d52672e7387625856c19299cfd584e1a3f39e0f98df13c99090df9f4d5cca8446776fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000e216b0008050001692e1c390101009000000000000003e800000000000013880000004526945a00 12534 DEBUG gossipd: Previously-rejected announce for 514127x248x1 10761 DEBUG 02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Got it! 10761 DEBUG 02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: ... , awaiting 1120 10761 DEBUG 02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Sending master 1020 ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 0fcaf19 commit fad257e

File tree

8 files changed

+317
-297
lines changed

8 files changed

+317
-297
lines changed

lightningd/lightningd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
213213
* who talk to us about long-closed channels. */
214214
ld->closed_channels = new_htable(ld, closed_channel_map);
215215

216-
/*~ We have a multi-entry log-book infrastructure: we define a 10MB log
217-
* book to hold all the entries (and trims as necessary), and multiple
216+
/*~ We have a multi-entry log-book infrastructure: we define a 16MB log
217+
* book to hold all the entries in a circular buffer, and multiple
218218
* log objects which each can write into it, each with a unique
219219
* prefix. */
220-
ld->log_book = new_log_book(ld, 10*1024*1024);
220+
ld->log_book = new_log_book(ld);
221221
/*~ Note the tal context arg (by convention, the first argument to any
222222
* allocation function): ld->log will be implicitly freed when ld
223223
* is. */

0 commit comments

Comments
 (0)