Sunday, March 23, 2014

Google Logger glog. How to turn off buffering?

Buffering of log messages could be an obstacle when you want messages to appear immediately in log file.
To turn off buffering or in another words flush all messages you need set next in your code:

// Initialize Google's logging library. 
google::InitGoogleLogging(argv[0]); 
FLAGS_logbufsecs = 0; 
FLAGS_logbuflevel = google::GLOG_INFO;