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 <boost/log/trivial.hpp>
#include <sys/wait.h>
#include <unistd.h>

void f(const char *const key)
{
    BOOST_LOG_TRIVIAL(info) << "Some logic: " << key;
}

int main()
{
    BOOST_LOG_TRIVIAL(info) << "Begin of app";
    f("main");
    const pid_t pid = fork();
    if (pid < 0) _exit(127);
    if (pid > 0) {
        // parent
        BOOST_LOG_TRIVIAL(info) << "Child: " << pid;
        f("after-fork main");
    } else {
        // child
        boost::log::core::get()->set_logging_enabled(false);
        // logging by other functions, is it safe?
        f("after-fork child");
        _exit(0);
    }
    int stat_loc;
    const pid_t rpid = ::wait(&stat_loc);
    BOOST_LOG_TRIVIAL(info) << "End of app, reaped " << rpid;
}
----

Any help would be greatly appreciated,

Aleksey