gpt4 book ai didi

erlang - erlang 中的截断错误报告

转载 作者:行者123 更新时间:2023-12-04 23:55:09 26 4
gpt4 key购买 nike

警告:前面的 erlang n00b。

我正在尝试掌握 erlang,只是尝试与牛仔一起使用基本的 hello world 应用程序。我正在模拟一个错误,基本上是在我的代码中的某处返回一个无效值,并试图解释该错误,即:

=ERROR REPORT==== 11-Jul-2013::15:45:00 ===
Error in process <0.167.0> with exit value: {{try_clause,{ok, {http_req,#Port<0.3619>,ranch_tcp,keepalive,<0.167.0>,<<3 bytes>>,'HTTP/1.1', {{127,0,0,1},60312},<<9 bytes>>,undefined,8081,<<1 byte>>,undefined,<<0 bytes>>,undefined,[],[{<<10 bytes>>,<<11 bytes>>},{<<4 bytes>>,<<14 bytes>>},{<<6 bytes>>,<<3 bytes>>}],[],undefined,[],waiting,undefined,<<0 bytes>>,false,waiting,[],<<0 bytes>>,undefined}}}, [{cowboy_handler,handler_init,4,[...

我已经用 rebar 设置了我的应用程序,我正在运行它:
erl -pa ebin deps/*/ebin -s myapp

如您所见,错误以“...”结尾,这让我认为它被截断了。有没有办法打印完整的报告?

而且,有没有办法让它漂亮地打印出来?

谢谢!

最佳答案

您看到的是 sasl 的 tty 处理程序。它格式化报告并将其写入控制台。在格式化过程中,它可能会削减一些有用的数据。
要避免它,请使用 error_logger_mf_h像这样的处理程序:

创建 app.config将一些变量传递给 sasl 的文件:

[

{sasl, [
{sasl_error_logger, {file, "sasl.log"}},
{errlog_type, all},
{error_logger_mf_dir, "."}, % Log directory
{error_logger_mf_maxbytes, 10485760}, % 10 MB max file size
{error_logger_mf_maxfiles, 5} % 5 files max
]}

].

然后用启动的 sasl 带上 erl 节点。日志将打印到 sasl.log
erl -boot start_sasl -config app.config

关于erlang - erlang 中的截断错误报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17596686/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com