How to get Google-glog output in console?



I am using a framework for convolutional neural networks called caffe and its output in console is provided by Google-glog. However when I try to save the output to a file using the following commands:

sh | tee output.txt


sh > output.txt

And I get a void file and the output does not save to the file. So I want to know how to retrieve this output.
Thanks in advance.


I am using Caffe too. You can try

sh 2>&1 | tee output.txt

You may also add option -i to tee to ignore Ctrl-C (which passes the SIGINT signal to instead of tee)

sh 2>&1 | tee -i output.txt

BTW, glog will write log messages to log files by default. The log files provide better severity level seperation than stdout and stderr.

Unless otherwise specified, glog writes to the filename “/tmp/<program name>.<hostname>.<user name>.log.<severity level>.<date>.<time>.<pid>”
(e.g., “/tmp/”).

By default, glog copies the log messages of severity level ERROR or FATAL to standard error (stderr) in addition to log files.

Location of the log file can be set by environment variable GLOG_log_dir or by command line flag log_dir (if gflags is installed). See for more detail.

Answered By – phil

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More