Search code examples
boost-log

Force boost logging core to shutdown?


Is there a way to force destruction of the boost logging core singleton? It can accessed via:

boost::log::core::get();

Which returns a shared pointer to the logging core. However, I need to shutdown / de-allocate it explicitly before my application closes other resources / detaches dll etc...

Is this possible?


Solution

  • No, the singleton only gets destroyed on application termination. But depending on what you're trying to achieve, you can make it release certain resources. For instance, by calling remove_all_sinks you can make it release all sinks, which will cause their destruction, unless they are referenced to from elsewhere.