linux – 如何在控制台中获取Google-glog输出?

我正在使用一个称为caffe的卷积神经网络框架,它在控制台中的输出由 Google-glog提供.但是当我尝试使用以下命令将输出保存到文件时:

sh train_imagenet.sh | tee output.txt

要么

sh train_imagenet.sh > output.txt

我得到一个void文件,输出不保存到文件.所以我想知道如何检索此输出.
提前致谢.

解决方法

我也在使用Caffe.你可以试试

sh train_imagenet.sh 2>&1 | tee output.txt

你也可以在tee中添加选项-i来忽略Ctrl-C(它将SIGINT信号传递给train_imagenet.sh而不是tee)

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

顺便说一句,glog默认会将日志消息写入日志文件.日志文件提供比stdout和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.

可以通过环境变量GLOG_log_dir或命令行标志log_dir(如果安装了gflags)设置日志文件的位置.有关详细信息,请参见https://godoc.org/github.com/golang/glog.

相关文章

/etc/sysctl.conf这个目录主要是配置一些系统信息,/etc/sys...
1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起...
它们都是多模式编辑器,不同的是vim 是vi的升级版本,它不仅...
不管是我们在安装软件还是监测软件的使用性能,我们都要随时...
装好Tomcat7后,发现除了本机能访问外界访问不了,岂有此理。...
修改防火墙配置需要修改 /etc/sysconfig/iptables 这个文件,...