Boost.Log to file and stdout at the same time?

I have successfully used boost::log to enter stdout (using the TRIVIAL macros) or to enter a file (basically following the instructions in the tutorial).

How do we configure simultaneous writing to a file and stdout?

This is a common use in our installation, when we want to have both a log file and all the output that goes to the log in the console.

Any input is appreciated!

+7
c ++ boost boost-log
source share
1 answer

According to the docs, you can just use add_console_log() convenient function:

 #include <boost/log/utility/setup/console.hpp> logging::add_console_log(std::cout, boost::log::keywords::format = ">> %Message%"); 

Of course, you can always figure out the configuration of the receiver manually, as indicated by some comments.

+15
source share

All Articles