I want to use Glog lib to log my application logs. My application is multithreaded. As Suggested in glog i have supposed to use RAW_LOG for thread safety. Here is my example code.
#include "stdafx.h"
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#include <glog/logging.h>
#include <glog/raw_logging.h>
using namespace std;
int main(int /*argc*/, char** argv)
{
FLAGS_alsologtostderr = 1;
google::SetLogDestination(google::GLOG_INFO, "E:/mylog.log");
google::InitGoogleLogging(argv[0]);
//LOG(INFO) << "Infomration";
RAW_LOG_INFO("Test");
RAW_LOG(INFO,"This is INFO");
RAW_LOG(WARNING,"This is WARNING");
RAW_LOG(ERROR, "This is Error");
return 0;
}
But log files are not generating if I use RAW_LOG but if I use LOG() function then log file is generating.
Please let me know how do I use RAW_LOG function or is LOG() function is threadsafe or not.
this is from the raw_logging.h
It can only log to stderr and is only for debugging purposes in low level code so
RAW_LOG(INFO,"...")
will never generate any log files.