google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
6.93k stars 2.05k forks source link

Flag GLOG_v failed to set in Mac environment and resulting in incorrect printing of logs #1090

Closed chen2016013 closed 4 months ago

chen2016013 commented 4 months ago

https://github.com/PaddlePaddle/Paddle/issues/61837

7408594f84d0fe4ae09b4b0c138fda6f

image

image

in the repo of paddlepaddle, We use glog and try to control output log level by the FLAG "GLOG_v". It works well except in the above environment. When running on Mac, GLOG_v doesn't seem to work on this line and it will be print even GLOG_v is set to 0.

sergiud commented 4 months ago

Thanks for reporting the issue. However, I cannot reproduce the described problem with the latest glog 0.7.0.

A simple test program

#include <glog/logging.h>

int main(int argc, char** argv)
{
    google::InitGoogleLogging(argv[0]);
    VLOG(8) << "foo";
    LOG(INFO) << "test";
}

generates the desired output:

$ GLOG_logtostderr=1 GLOG_v=0 ./foo 
I20240328 16:35:36.823674 126464463306304 t.cc:7] test
$ GLOG_logtostderr=1 GLOG_v=8 ./foo 
I20240328 16:36:07.026887 133151090474560 t.cc:6] foo
I20240328 16:36:07.026932 133151090474560 t.cc:7] test

In case you still experience the issue with glog 0.7.0 please make sure to provide enough information that would allow to reproduce the problem.

I'm closing the issue in the meantime since there is nothing actionable.