加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-14 01:23:46 所属栏目:Linux 来源:网络整理
导读:我正在使用一个称为caffe的卷积神经网络框架,它在控制台中的输出由 Google-glog提供.但是当我尝试使用以下命令将输出保存到文件时: sh train_imagenet.sh | tee output.txt 要么 sh train_imagenet.sh output.txt 我得到一个void文件,输出不保存到文件.所以
我正在使用一个称为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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读