【发布时间】:2018-10-01 15:28:09
【问题描述】:
我想将我的Ballerina 程序的日志保存到一个文件中,同时在终端上显示它,所以我使用了以下命令:
$ ballerina run sample.balx |tee out.log
但是,即使程序成功执行并在终端上显示日志,这也不会在 out.log 文件中写入任何内容。
【问题讨论】:
标签: ballerina
我想将我的Ballerina 程序的日志保存到一个文件中,同时在终端上显示它,所以我使用了以下命令:
$ ballerina run sample.balx |tee out.log
但是,即使程序成功执行并在终端上显示日志,这也不会在 out.log 文件中写入任何内容。
【问题讨论】:
标签: ballerina
上述命令是将stdout写入文件。但是,Ballerina writes its logs to the stderr stream。所以你必须使用下面的命令。
ballerina run sample.balx 2>&1 | tee out.log
此命令将stderr 重定向到stdout,因此tee 可以将其回显到显示器和文件中。
【讨论】: