Date: 2005-06-30 02:52:50
Greg Landrum wrote:
> I'm trying to get the logs to dump their output to std:cerr immediately:
> However, the output from running this is always something like:
> [14:56:35] 2
> [14:56:35] 4
> So the logger output is "late". Is there some flag I can set (or
> appender I can use) that will force output to go to the target streams
> immediately or is this outside the design of the logging library?
I also happened to stumble accross this. The problem is that log caching
turned on initially and you have to explicitly turn it off.
Basically, it should work if you change your code to this:
// now flush the log cache; this also turns off log caching, so from now
// on all log output is not cached, but written out immediately
std::cerr << "1" << std::endl;
BOOST_LOG(cerrLog) << "2" << std::endl;
std::cerr << "3" << std::endl;
BOOST_LOG(cerrLog) << "4" << std::endl;
See the docs for more details on this.
Phone: +43 7229 78040-218
Fax: +43 7229 78040-209
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk