[Log] fork safety and core::set_logging_enabled(false)
Hi,
I am developing a project which executes some non-trivial code
after fork and before exec. This code contains logging statements
"BOOST_LOG_TRIVIAL(..)". I know that Boost.Log is not safe to use
in child created by fork, but it this particular case it is fine to just
disable
logging in child process to make it safe. However I would prefer
to keep these logging statements and disable logging somehow else,
like setting some global flag.
There is a boost::log::core::set_logging_enabled() function
which seems to be the solution to this problem. Documentation says:
"Setting this status to false allows you to completely wipe out
any logging activity, including filtering and generation of attribute
values."
Unfortunately there is no note about fork safety.
The question is:
Is it safe to use it to disable logging in child process,
even if application will try to execute log statements?
Below is simple code sample.
----
#include
participants (1)
-
Алексей Филиппов