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

how to log before coredump #2166

Closed
f1msch opened this issue Nov 11, 2021 · 2 comments
Closed

how to log before coredump #2166

f1msch opened this issue Nov 11, 2021 · 2 comments

Comments

@f1msch
Copy link

f1msch commented Nov 11, 2021

Is there any method to flush every log before my programe coredump? I use flush_every(seconds(1)) now but the time granularity seems too large that it cannot provider enough logs to me.
Even more could it log any more backtrace at coredump time, it seems more useful than only use "gdb coredump"

@tt4g
Copy link
Contributor

tt4g commented Nov 11, 2021

It will not be possible to flush the logs before the core dump.
Because core dump is caused by an abnormal termination of the program.

Consider that it is impossible to rescue the log from a process with abnormal behavior.

It is always better to flush the log with a process that is running normally.
If you want to always flush the log, call spdlog::flush_on(spdlog::level::trace) or spdlog::logger::flush_on(spdlog::level::trace).

@f1msch
Copy link
Author

f1msch commented Nov 12, 2021

It will be nice,I will try it

@f1msch f1msch closed this as completed Nov 12, 2021
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

2 participants