i am tryng to implement the GLOG lib in my project, but i am only getting console outputs, and i cannot allow to create the file log with the severity asociated, here is my code: i am developing for linux (ubuntu)
#include <glog/logging.h>
int main(int argc, char *argv[])
{
google::SetLogDestination(0,"/home/ricardo/Desktop/CODIGO/info.log");
google::SetLogDestination(google::WARNING,"");
FLAGS_logtostderr = 1;
google::InitGoogleLogging("log_test");
LOG(INFO) << "Found " << 2332 << " cookies";
return 0;
}
any help?? thx in advance!
The line google::SetLogDestination(google::WARNING,"");
looks pretty suspicious.
This line:
FLAGS_logtostderr = 1;
tells Glog to write to the console, instead of a file. For details, see the section entitled Setting Flags in Google Log's how-to document: http://google-glog.googlecode.com/svn/trunk/doc/glog.html
If you want to write to a file, delete the line containing FLAGS_logtostderr
.
Also, why not use INFO
instead of 0
in the first case? It would make it clearer.