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
Async logger crash after fork() #166
Comments
spdlog does not support multi process. I dont think there is a quick workaround |
Does that mean I can't use spdlog in daemon? |
it depends which type of daemon of course |
I'm working on a server (reading data through socket), and it's crashing when I run in as daemon. Are there any special steps I should be taking, in regards to spdlog library? |
make sure you create the loggers after the fork |
I have logger declared in global scope as |
I managed to got it working, but seems I have to manually call |
there is a force_flush param you can use. please see the |
Here is my situation:
A main process have a global async logger, and then it will fork several subprocesses.
When the subprocess call log function of the global async logger, the process dead because the _worker_thread in the new process is no longer the thread in the main process.
Maybe we can do some cleanup when _worker_thread::id != this_thread::get_id() or so?
Thanks.
The text was updated successfully, but these errors were encountered: