【问题标题】:How can I redirect Ballerina logs to a file while still displaying it on the terminal如何在终端上显示的同时将 Ballerina 日志重定向到文件
【发布时间】:2018-10-01 15:28:09
【问题描述】:

我想将我的Ballerina 程序的日志保存到一个文件中,同时在终端上显示它,所以我使用了以下命令:

$ ballerina run sample.balx |tee out.log

但是,即使程序成功执行并在终端上显示日志,这也不会在 out.log 文件中写入任何内容。

【问题讨论】:

    标签: ballerina


    【解决方案1】:

    上述命令是将stdout写入文件。但是,Ballerina writes its logs to the stderr stream。所以你必须使用下面的命令。

    ballerina run sample.balx 2>&1 | tee out.log
    

    此命令将stderr 重定向到stdout,因此tee 可以将其回显到显示器和文件中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-19
      • 2017-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多