I did some research. Consider next changed main
function:
int main(int, char*[])
{
init();
src::logger lg;
BOOST_LOG(lg) << "Hello world #1!";
BOOST_LOG(lg) << "Hello world #2!";
std::cin.get();
BOOST_LOG(lg) << "Hello world #3!";
BOOST_LOG(lg) << "Hello world #4!";
return 0;
}
So std::cin.get()
acts as pause, launch application in normal mode (without debugging, Ctrl + F5 from VS2008, or simply executing *.exe
from Debug
folder) and when you reach input part (std::cin.get()
) just go to Task Manager and kill the process. Depending on value of auto_flush
results are next:
auto_flush(false)
-- log file is empty!auto_flush(true)
-- log file will contain first two records, made beforestd::cin.get()
Changing std::cin.get()
to throw 1
gives always first two records being written to log file, regarding of if auto_flush
set to true
or false
both in Release
and Debug
builds.
So, the conclusion is that auto_flush
works fine, it's just has a bit strange behaviour when debugging directly from Visual Studio.