截断的错误报告在erlang [英] Truncated error report in erlang

查看:95
本文介绍了截断的错误报告在erlang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告:erlang n00b提前。

Warning: erlang n00b ahead.

我试图抓住erlang,只是尝试一个基本的hello世界应用程序与牛仔。我正在模拟一个错误,基本上在我的代码中返回一个无效值,并尝试解释错误,这是:

I'm trying to get a grasp of erlang, and just trying a basic hello world application with cowboy. I'm simulating an error, basically returning an invalid value somewhere in my code, and trying to interpret the error, which is:

=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,[...

我已经使用钢筋设置了我的应用程序,我正在运行它:

I've setup my application with rebar, and I'm running it with:

erl -pa ebin deps/*/ebin -s myapp

如您所见,错误以.. 这让我觉得它被截断了。有没有办法打印完整的报告?

As you can see, the error ends with "..." which makes me think it is being truncated. Is there any way to print the full report?

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

And, is there any way to make it pretty-print it?

谢谢!

推荐答案

你看到的是sasl的tty处理程序。它将报告格式化并写入控制台。在格式化期间,它可以减少一些有用的数据。
为避免这种情况,请使用 error_logger_mf_h 处理程序,如下所示:

What you see is sasl's tty handler. It formats and writes reports to console. During formatting it could cut some useful data. To avoid it, use error_logger_mf_h handler like this:

创建应用程序.config 文件将一些vars传递给sasl:

Create app.config file to pass some vars to 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

Then bring erl node with started sasl. Logs will be printed into sasl.log

erl -boot start_sasl -config app.config

这篇关于截断的错误报告在erlang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆