It seems that Boost Log is a good choice for cross platform logging. However, boost log is not part of Boost, at least not in the regular Boost branch. If you want to use this in you code, just follow the steps.

  1. Download Boost Log separately from here.
  2. Download Boost above version 1.51. I am using Boost version 1.53.0.
  3. Unzip the Boost source file, and unzip Boost Log file into the specific folder.
  4. Then compile the Boost file by Boost instruction. After the compilation, the Boost Log library will be under folder /boost_1_53_0/stage/lib or the installation folder you prefixed.

Then you can use the static Boost Log library in your code. Here is the example code:

#include <boost/log/trivial.hpp>

int main(int, char*[]) { BOOST_LOG_TRIVIAL(trace) « “A trace severity message”; BOOST_LOG_TRIVIAL(debug) « “A debug severity message”; BOOST_LOG_TRIVIAL(info) « “An informational severity message”; BOOST_LOG_TRIVIAL(warning) « “A warning severity message”; BOOST_LOG_TRIVIAL(error) « “An error severity message”; BOOST_LOG_TRIVIAL(fatal) « “A fatal severity message”;

return 0;

}