How to get Google-glog output in console?
Solution 1
I am using Caffe too. You can try
sh train_imagenet.sh 2>&1 | tee output.txt
You may also add option -i to tee to ignore Ctrl-C (which passes the SIGINT signal to train_imagenet.sh instead of tee)
sh train_imagenet.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/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474").
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 https://godoc.org/github.com/golang/glog for more detail.
Solution 2
Use FLAGS_alsologtostderr = 1;
in main()
.
For more infomation, check Setting Flags
section in glog's doc.
ssierral
Computer Engineer. MSc Computer Engineering student at Universidad Nacional de Colombia. Working on Natural Language Processing.
Updated on June 08, 2022Comments
-
ssierral almost 2 years
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 train_imagenet.sh | tee output.txt
or
sh train_imagenet.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.