Boost logo

Boost :

Subject: [boost] [log] Can Boost.Log be used in clean-up functions?
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2010-06-15 16:24:26

By 'clean-up functions' I mean destructors or automatic objects,
destructors of static objects, functions registered with std::atexit
and std::terminate.
So, what I want to ask is:
Can I use Boost.Log for logging inside destructors of automatic
objects? Destructors are exected not to throw by STL containers and
algorithms, also it is often taught that a destructor throwing during
stack unwinding ...
Can the logging throw an exception? I guess it cn, and I guess, it my
be unsafe to log in the destructor. Am I right?

Can I use Boost.Log in functions that are run after function main
finishes? I.e. can I safely log in destructors of static objects, or
functions registered with std::atexit? Similarly, can I log in the
std::terminate (if I have installed my custom handler)? When are log
sources or sinks destroyed?


Boost list run by bdawes at, gregod at, cpdaniel at, john at