What does "InitGoogleLogging" do?

11,641

First of all, argv[0] is not the first argument you pass to your executable, but rather the executable name. So you are passing to ::google::InitGoogleLogging the executable name and not the prototxt file.
'glog' module (google logging) is using this name to decorate the log entries it outputs.

Second, caffe is using google logging (aka 'glog') as its logging module, and hence this module must be initialized once when running caffe. This is why you have this

::google::InitGoogleLogging(argv[0]);

in your code.

Share:
11,641
Jack Simpson
Author by

Jack Simpson

Student currently studying science/arts with a major in web development branching out into Python and Perl programming.

Updated on July 16, 2022

Comments

  • Jack Simpson
    Jack Simpson almost 2 years

    I've been modifying an example C++ program from the Caffe deep learning library and I noticed this code on line 234 that doesn't appear to be referenced again.

    ::google::InitGoogleLogging(argv[0]);
    

    The argument provided is a prototxt file which defines the parameters of the deep learning model I'm calling. The thing that is confusing me is where the results from this line go? I know they end up being used in the program because if I make a mistake in the prototxt file then the program will crash. However I'm struggling to see how the data is passed to the class performing the classification tasks.

  • Will S
    Will S almost 3 years
    glog can now be found on github: github.com/google/glog the SVN link is very dead indeed