
I'm just getting started with John Torjo's logging library. So far the library looks really useful, but I'm having problems understanding the timing/sequencing of output by the logging objects. I'm trying to get the logs to dump their output to std:cerr immediately: // ----------------------------- #include <iostream> #include <boost/log/log.hpp> #include <boost/log/functions.hpp> namespace logging = boost::logging; BOOST_DECLARE_LOG(cerrLog); BOOST_DEFINE_LOG(cerrLog,"cerrLog"); void write_to_cerr(const std::string &, const std::string &msg) { std::cerr << msg; std::cerr.flush();} int main(){ logging::add_modifier("cerrLog",logging::prepend_time("[$hh:$mm:$ss] "), logging::DEFAULT_INDEX-10); logging::add_appender("cerrLog",write_to_cerr,logging::DEFAULT_INDEX+1); std::cerr << "1" << std::endl; BOOST_LOG(cerrLog) << "2" << std::endl; std::cerr << "3" << std::endl; BOOST_LOG(cerrLog) << "4" << std::endl; } // ----------------------------- However, the output from running this is always something like: 1 3 [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? In the event that it matters: I'm using version 1.33 of the logging library and I've tested this on both Windows (vs .net 2003) and Linux (g++ v3.2). Thanks, -greg