Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per file log levels #6406

Merged

Conversation

rustyrussell
Copy link
Contributor

This has been long outstanding request (#5392), and rather than push it back another milestone (again!) I've implemented it. Cleaned some things up too.

`struct log` becomes `struct logger`, and the member which points to the
`struct log_book` becomes `->log_book` not `->lr`.

Also, we don't need to keep the log_book in struct plugin, since it has
access to ld's log_book.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rather than exposing the filtering internals.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is where it's set, not some random logger.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@grubles
Copy link
Contributor

grubles commented Jul 17, 2023

I can't seem to create separate INFO and DEBUG logs.

log-file=/path/to/debug.log
log-level=debug:/path/to/debug.log

log-file=/path/to/info.log
log-level=info:/path/to/info.log

CLN will create both files but only log INFO messages to both. Do I need something like log-file2 / log-level2 for the second log?

@rustyrussell
Copy link
Contributor Author

I can't seem to create separate INFO and DEBUG logs.

log-file=/path/to/debug.log
log-level=debug:/path/to/debug.log

You want two :: here, the second is the prefix-matching pattern. Since the default is info, you're only getting info messages here, since no prefixes match the pattern.

log-file=/path/to/info.log
log-level=info:/path/to/info.log


CLN will create both files but only log INFO messages to both. Do I need something like `log-file2` / `log-level2` for the second log?

You probably want:

# Anything >= info goes here.
log-level=info::/path/to/info.log
# Anything >= debug goes here.
log-level=info::/path/to/debug.log

@grubles
Copy link
Contributor

grubles commented Jul 18, 2023

That did the trick, @rustyrussell. I now have an info.log with INFO messages only, and a DEBUG log (debug.log) where the firehose is enabled.

@rustyrussell rustyrussell force-pushed the guilt/per-file-log-levels branch 2 times, most recently from db03a19 to e998603 Compare July 19, 2023 03:49
Rather than initializating the "print_level" field on first use, we can
do it in logging_options_parsed(), now we have a linked list of them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: ElementsProject#5392
Changelog-Added: config: `log-level` can be specified on a per-logfile basis.
Without this, only per-peer daemons were filtered correctly.  For generic
daemons, we need to filter with the actual nodeid they use (if any).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: config: `log-level` filters now apply correctly to messages from `connectd`.
@rustyrussell rustyrussell merged commit e5d0d69 into ElementsProject:master Jul 19, 2023
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants