Aqu*_*wer 2 command-line log redirect tee
为什么不使用三通?因为输出的终端渲染使应用程序运行速度变慢。
出于某种原因,这不起作用:
application 2>&1 >"$logFile"
Run Code Online (Sandbox Code Playgroud)
输出一直到终端..
您已重定向stderr到stdout(终端),然后您已重定向stdout到一个文件。总之,您还没有重定向stderr到该文件:
stderr -> stdout,stderr前往终端。stdout -> $logfile,stdout转到$logfile。尝试使用以下方法:
application >"$logfile" 2>&1
Run Code Online (Sandbox Code Playgroud)
注意顺序很重要:
stdout -> $logfile,stdout去$logfile。stderr -> stdout -> $logfile,stderr转到stdout与 相同$logfile。| 归档时间: |
|
| 查看次数: |
5165 次 |
| 最近记录: |