On Wed, Jul 1, 2015 at 5:41 PM, Andrey Semashev
On 02.07.2015 00:16, Andrew Hundt wrote:
Is there a straightforward non-intrusive solution to having as much of the work as possible for boost.log be done in a separate thread?
Boost.Log does support asynchronous logging[1] although the current implementation might not suit well for realtime use either. It does have a lock in the internal record queue which is used to pass log records from the application threads to the log processing thread, although the critical section is minimal.
In order to enable async logging you have to configure the library by adding asynchronous sinks and probably some attributes on your application startup. You can keep using BOOST_LOG_TRIVIAL for emitting log records, the only change needed is the initial configuration.
[1] http://www.boost.org/doc/libs/1_58_0/libs/log/doc/html/log/detailed/sink_fro...
Thanks for the feedback, that looks like it could be the right way to go about it! 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? Cheers! Andrew Hundt