Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Truncated error report in erlang

Tags:

erlang

Warning: erlang n00b ahead.

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?

Thanks!

like image 662
Matt Avatar asked Jul 11 '13 14:07

Matt


1 Answers

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:

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
]}

].

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

erl -boot start_sasl -config app.config
like image 197
danechkin Avatar answered Nov 15 '22 09:11

danechkin