
From: Caleb Epstein <caleb.epstein@gmail.com>
If one uses the supplied write_to_file appender, the messages will be written to the output file as soon as they are complete. So for example,
BOOST_LOG(debug) << "Wrote " << len << " bytes to socket fd " << fd;
would write a single message like "Wrote 56 bytes to socket 3" or nothing at all (e.g. if the application crashed sometime in the middle of formatting the message). I think this is eminently reasonable and hardly "useless".
The point is not so clear if the expression following BOOST_LOG() includes side effects that cause the application to crash, for example. If the stream provided by BOOST_LOG() were unbuffered, then output would be flushed as soon as it was formatted, so you'd get output up until the point of the crash. Any buffering means that the buffered output is lost when the app crashes. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;