Ricardo_arg Ricardo_arg - 1 year ago 164
C++ Question

GLOG - no output file log is created

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[])

FLAGS_logtostderr = 1;
LOG(INFO) << "Found " << 2332 << " cookies";

return 0;


any help??
thx in advance!

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download