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

Write logs to disk automatically #1623

Closed
cdecker opened this issue Jun 24, 2018 · 6 comments
Closed

Write logs to disk automatically #1623

cdecker opened this issue Jun 24, 2018 · 6 comments
Assignees
Milestone

Comments

@cdecker
Copy link
Member

cdecker commented Jun 24, 2018

Besides keeping logs in memory for live inspection, and printing them to stdout, we should also have a log file to which log-entries get appended. This should make debugging a lot easier since users tend to not tee logs into files until something bad happens, and telling them that they should save logs in case it happens again is just not helpful.

@cdecker cdecker added the logs label Jun 24, 2018
@cdecker cdecker added this to the v0.6.1 milestone Jun 24, 2018
@cdecker cdecker self-assigned this Jun 24, 2018
@cdecker cdecker modified the milestone: v0.6.1 Jun 25, 2018
@gabridome
Copy link
Contributor

[niceToHave] It would be nice to put in place some kind of log rotation too maybe.

@jb55
Copy link
Collaborator

jb55 commented Jun 27, 2018 via email

@gabridome
Copy link
Contributor

gabridome commented Jun 27, 2018

that's probably best left to tools like logrotate

Absolutely but as @cdecker says:

This should make debugging a lot easier since users tend to not tee logs into files until something bad happens, and telling them that they should save logs in case it happens again is just not helpful.

If our aim is to manage log information for debugging purposes, maybe it is better to manage them in a proper way ourselves also helping him to find the information we need. Logrotate is not a user oriented tool. Just pondering.

I have only today zipped my lightning.log file (700M) into a 25M one. I have sweared to myself I will configure logrotate but I don't think the average user will do it.

@cdecker
Copy link
Member Author

cdecker commented Jun 27, 2018

Well, my idea is to basically give the usual hooks for logrotate et al., i.e., register a SIGUSR1 handler (used for IO logging on subdaemons but master it's not yet) that reopens the log-file. This allows logrotate to move the file (not invalidating the fd that lightningd uses to append logs lines), then issue SIGUSR1 to lightningd, which causes it to detach from the moved one and create a new one, and then logrotate can do whatever it pleases with the rotated log.

@rustyrussell
Copy link
Contributor

SIGHUP is standard for log rotation. But I agree...

rustyrussell added a commit to rustyrussell/lightning that referenced this issue Aug 15, 2018
Closes: ElementsProject#1623
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Aug 20, 2018
Closes: ElementsProject#1623
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Aug 22, 2018
Closes: ElementsProject#1623
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cdecker pushed a commit to rustyrussell/lightning that referenced this issue Aug 22, 2018
Closes: ElementsProject#1623
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Aug 22, 2018
Closes: ElementsProject#1623
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@cdecker
Copy link
Member Author

cdecker commented Aug 23, 2018

#1847 only partially addressed this issue. Its main goal is to always log to file, independently of whether we also log to stdout or not. The problem is that by default we just log to stdout and users are losing the logs in the scrollback buffers of their terminals making it really hard to trace issues.

@cdecker cdecker reopened this Aug 23, 2018
@cdecker cdecker modified the milestones: v0.6.1, v0.6.2 Sep 20, 2018
@cdecker cdecker modified the milestones: v0.6.2, v0.6.3 Oct 22, 2018
@rustyrussell rustyrussell modified the milestones: v0.6.3, v0.6.4 Jan 9, 2019
@cdecker cdecker modified the milestones: v0.6.4, v0.7 Feb 11, 2019
@rustyrussell rustyrussell modified the milestones: v0.7, 0.7.1 Feb 23, 2019
@rustyrussell rustyrussell modified the milestones: 0.7.1, 0.7.2 Jun 4, 2019
@cdecker cdecker closed this as completed Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants