Boost logo

Boost :

Subject: Re: [boost] [Log] Running in a separate thread
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-07-29 13:46:31


On 29.07.2015 19:48, Andrew Hundt wrote:
>
> However, I'm a bit unlucky because my application is implemented as
> dynamically loaded modules attached to another application, which there is
> a large warning about in your link. Do you know of any additional more
> detailed information about how best to ensure the data lifetimes are
> managed correctly so async sinks don't crash when modules are loaded or
> unloaded?

Well, the best way to avoid problems is to never unload modules. Most
likely, you're dealing with a limited set of modules, so this won't
result in resource leakage.

Ensuring that module-specific data/code is no longer used can be very
tricky and fragile and can affect not only Boost.Log. In general, you
should avoid adding attributes, sinks or any kind of factories in your
modules, or at least make sure they are removed before you unload a
module. Also avoid global loggers because typically it's difficult to
control which module creates them. And before unloading a module call
logging::core::get()->flush() so that all buffered log records are
processed. This may not be an exhaustive list, I may be forgetting
something.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk