Skip to content

Append to crash log instead of creating new one - #1197

Merged
cdecker merged 1 commit into
ElementsProject:masterfrom
jBarz:logappend
Mar 11, 2018
Merged

cdecker merged 1 commit into
ElementsProject:masterfrom
jBarz:logappend

Conversation

@jBarz

@jBarz jBarz commented Mar 10, 2018

Copy link
Copy Markdown
Contributor

Multiple crashes accumulate in case you have some kind
of auto-restart for daemons.

Comment thread lightningd/log.c Outdated
struct log_data data;
time_t start;

sprintf(buf, "%s\n", "Start of new crash log");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not strcpy(buf, "Start of new crash log\n");? Or even write_all(fd, "Start of new crash log\n", strlen("Start of new crash log\n"));, a technique used a few lines below?

@jBarz jBarz Mar 11, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I changed it to the latter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also added another optimization below where we unnecessarily calculate strlen

Multiple crashes accumulate in case you have some kind
of auto-restart for daemons.
@ZmnSCPxj

Copy link
Copy Markdown
Contributor

ACK 9c71ed6

@cdecker

cdecker commented Mar 11, 2018

Copy link
Copy Markdown
Member

I'd eventually prefer to have a rotation in place to have numbered crashes and not needing to search for the end-of-crash markers, but this fixes the immediate problem, so:

ACK 9c71ed6

@cdecker
cdecker merged commit b4f7ce6 into ElementsProject:master Mar 11, 2018
@cdecker cdecker mentioned this pull request Mar 11, 2018
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

Successfully merging this pull request may close these issues.

3 participants