pombreda / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Dynamically change verbosity level: is there a way? #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, 
I am attempting to code up a program that would allow me to dynamically change 
the verbosity level of a running component/module. Is this possible?

Things I have tried:

1) Currently, I have a function set up in a callback structure that changes the 
value of the environment variable GLOG_v, or GOOGLE_v. 

When I test my code, I am in fact changing the value of the environment 
variable, but it seems to have no effect on the logging behavior.

For example, I run: 
GLOG_v=2 ./sample_app 

And then change the value of GLOG_v to be 3, so that calls to VLOG(3) will 
execute. But they do not-- even after this environment variable is set to 3, I 
only get messages in the log from VLOG(2) and no higher. 

2) I found a function called SetVLOGLevel that appears to be what I want. Yet, 
when I call that function in my sample app, I get a SIGABRT with the following 
backtrace:

#0  0x00007ff177eef095 in raise () from /lib/libc.so.6
#1  0x00007ff177ef0af0 in abort () from /lib/libc.so.6
#2  0x00007ff17901b9d1 in google::InitVLOG3__ (site_flag=0x7ff179226548, 
site_default=0x7ff1792365c0, 
    fname=0x7ff17902166d "src/vlog_is_on.cc", verbose_level=1) at src/base/mutex.h:249
#3  0x00007ff17901bc7e in google::SetVLOGLevel (
    module_pattern=0x7fff81860946 "/sample_app", 
    log_level=5) at src/vlog_is_on.cc:189
#4  0x00000000004039e1 in main (argc=1, argv=0x7fff8185ffc8) at sample_app.cc:68

My initial hunch is I need to set my verbosity level explicitly with vmodule to 
avoid this error-- does that sound reasonable? 

Any hints in the right direction (even if that "right direction" is to turn 
around and go back) would be much appreciated! Thanks in advance.

I'm using glog-0.3.3 and running on Mac OS X. 

Original issue reported on code.google.com by raine.ho...@gmail.com on 9 Aug 2013 at 12:13

GoogleCodeExporter commented 9 years ago
Apologies: working on a Mac, building on Ubuntu 8.04

Original comment by raine.ho...@gmail.com on 9 Aug 2013 at 12:31

GoogleCodeExporter commented 9 years ago
same as issue #53, patch in there.. any chance this will be wrapped into a 
release?

Original comment by JeffreyD...@gmail.com on 29 Aug 2013 at 1:14