5

My purpose is simple: to somehow see the logs printed by VLOG(5), which is provided by the glog library.

I have the following code:

google::InitGoogleLogging(argv[0]);
google::ParseCommandLineFlags(&argc, &argv, true);
FLAGS_logtostderr = 1;
FLAGS_v = 10;
LOG(INFO) << "info"; // OK, I see it
LOG(WARNING) << "warning"; // OK
VLOG(5) << "vlog"; // Nothing :(

No matter I manually set the flags here (FLAGS_logtostderr and FLAGS_v) or I pass it through the command line (--v=10), I just never find the string "vlog" anywhere: neither stdout, stderr nor some log file under \tmp. I think I didn't change the output path though.

Do I miss anything here? Any idea how to enable VLOG?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
zzy
  • 751
  • 1
  • 13
  • 25
  • It seems that the FLAGS_xxx stuff works only "If the Google gflags library is installed on your machine". – cow Nov 04 '18 at 02:19

1 Answers1

5

Personally, I've never tried it with

FLAGS_logtostderr = 1;

FLAGS_v = 10;

The VLOG works fine for me if I set "GLOG_v=x" as an environmental variable on both linux and windows. E.g.

Alternatively, if you want to test it on the command line you can do the following:

Windows: C:>set GLOG_v=5 C:>set GLOG_logtostderr=1 C:>YourProgramName

Linux: $ GLOG_v=7 GLOG_logtostderr=1 ./YourProgramName

Community
  • 1
  • 1
Ralf
  • 9,405
  • 2
  • 28
  • 46