...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
It should be fine to use logging during the application initialization (i.e.
before main()
starts). But there are a number of known problems with Boost.Log that prevent
it from being used at process termination (i.e. after the main()
function returns), so the official answer
to the second part is no. It may work though, in some very restricted setups,
if several rules are followed:
main()
starts).
logging::core::get()
at process termination. Get that pointer as early as possible and keep
it until the process terminates.
These rules don't guarantee that the library will work in termination context but they may help to avoid problems. The library will get improved to support this use case better.