SetVLOGLevel usage

670 views
Skip to first unread message

Kolya Bocharov

unread,
Jan 24, 2012, 4:08:58 PM1/24/12
to google-glog
Hi

could please someone help me with the issue below -
I have the following code -

void main(int argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
google::SetLogDestination(google::GLOG_INFO, "./log.mmdsd");

LOG(INFO) << "INFO this is a very long string to log out";
LOG(WARNING) << "WARNING this is a very long string to log out";
LOG(ERROR) << "ERROR this is a very long string to log out";
google::SetVLOGLevel("*", 10);

VLOG(0) << " 0 verbose log";
VLOG(1) << " 1 verbose log";
VLOG(2) << " 2 verbose log";
}
and get the following output in target file -
I0124 12:54:38.670425 6980 main.cpp:20] INFO this is a very long
string to log out
W0124 12:54:38.701625 6980 main.cpp:21] WARNING this is a very long
string to log out
E0124 12:54:38.701625 6980 main.cpp:22] ERROR this is a very long
string to log out
I0124 12:54:38.701625 6980 main.cpp:25] 0 verbose log

So, I set Verbose log level to 10 and expect to see all 3 lines of
levels 1, 2 and 3 logged in output file but only 0-level line appears
in log file.Could you please explain what i'm doing wrong?

thank you

Igor Zavoychinskiy

unread,
Jan 24, 2012, 5:27:06 PM1/24/12
to googl...@googlegroups.com
Hello,

Looks like you're compiling this code under Windows. If so than this function won't work for you since it overrides --vmodule behavior which is unsupported in non gcc compilers.

- Igor

2012/1/24 Kolya Bocharov <nboc...@hotmail.com>

--
You received this message because you are subscribed to the Google Groups "google-glog" group.
To post to this group, send email to googl...@googlegroups.com.
To unsubscribe from this group, send email to google-glog...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-glog?hl=en.


Kolya Bocharov

unread,
Jan 25, 2012, 3:38:16 PM1/25/12
to google-glog
Hi Igor

Thank you very much for your help! and yes, I do compile it under
Windows, use VS2010
I just looked though the code and found that if I set value for
FLAGS_v variable manually it works as expected. Just curious if it's
safe and I do not break anything? here is the code -

FLAGS_v = 2;
VLOG(0) << "Verbose 0";
VLOG(1) << "Verbose 1";
VLOG(2) << "Verbose 2";
VLOG(3) << "Verbose 3";
VLOG(4) << "Verbose 4";

Thank you

Igor Zavoychinskiy

unread,
Jan 25, 2012, 5:29:23 PM1/25/12
to googl...@googlegroups.com
Setting flags is technically a safe operation but you need to do that at the right place. Otherwise, you may get situation when part of your code works with default or parsed flag value and the rest with the overridden one.

2012/1/25 Kolya Bocharov <nboc...@hotmail.com>

Thank you

Reply all
Reply to author
Forward
0 new messages