-
Notifications
You must be signed in to change notification settings - Fork 800
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
[Merged by Bors] - Ensure logfile respects the validators-dir CLI flag #3003
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I just have a couple of minor nits. Feel free to include them if you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
bors r+ |
## Issue Addressed Closes #2990 ## Proposed Changes Add a check to see if the `--validators-dir` CLI flag is set and if so store validator logs into it. Ensure that if the log directory cannot be created, emit a `WARN` and disable file logging rather than panicking. ## Additional Info Panics associated with logfiles can still occur in these scenarios: 1. The `$datadir/validators/logs` directory already exists with the wrong permissions (or was changed after creation). 1. The logfile already exists with the wrong permissions (or was changed after creation). > These panics are cosmetic only since only the logfile thread panics. Following the panics, LH will continue to function as normal. I believe this is due to the use of [`slog::Fuse`](https://docs.rs/slog/latest/slog/struct.Fuse.html) when initializing the logger. I'm not sure if there a better way of handling logfile errors? I think ideally, rather than panicking, we would emit a `WARN` to the stdout logger with the panic reason, then exit the logfile thread gracefully.
Pull request successfully merged into unstable. Build succeeded: |
Issue Addressed
Closes #2990
Proposed Changes
Add a check to see if the
--validators-dir
CLI flag is set and if so store validator logs into it.Ensure that if the log directory cannot be created, emit a
WARN
and disable file logging rather than panicking.Additional Info
Panics associated with logfiles can still occur in these scenarios:
$datadir/validators/logs
directory already exists with the wrong permissions (or was changed after creation).I believe this is due to the use of
slog::Fuse
when initializing the logger.I'm not sure if there a better way of handling logfile errors?
I think ideally, rather than panicking, we would emit a
WARN
to the stdout logger with the panic reason, then exit the logfile thread gracefully.