I'm having trouble redirecting Boost-generated logs from the shell. We start out simply enough with an application that successfully logs to stdout.
cjholmes$ ./my_application
[2017-03-14 10:21:16.920355] [0x00007fff79497300] [info] Boost log severity set to trace
[2017-03-14 10:21:16.921071] [0x0000000101282000] [trace] Adding "/Users/cjholmes/Desktop/idsconnector/ca/DigiCertHighAssuranceEVRootCA.pem"
[2017-03-14 10:21:16.921233] [0x0000000101282000] [trace] Adding "/Users/cjholmes/Desktop/idsconnector/ca/DigiCertSHA2HighAssuranceServerCA.pem"
Easy, right? So I should be able to do this:
cjholmes$ ./my_application > log.txt
No output is sent to the console (which is expected), but when I look in the log.txt file, it is empty. The shell creates the file, but the file is always empty.
I have tried all of the usual redirection syntaxes too, and none of them work. Also, I have tried explicitly initializing the log with std::cout:
boost::log::add_console_log(std::cout);
I still get the same result. I can always get the log data on the console, but redirecting the output somehow loses all my log data.
What am I missing?