0

When I start my application with the shell I see all error_logger reports twice.

One version is formatted like with ~p and the there is the nicely formatted one:

{info_report,<0.48.0>,
             {<0.425.0>,std_info,
              [{chan,ser_200},
               usb_port,send,
               {data,"6d e1 00 00 00 04 00 00 06 8f"}]}}

=INFO REPORT==== 8-Apr-2011::16:43:24 ===
    chan: ser_200
    usb_port
    send
    data: "6d e1 00 00 00 04 00 00 06 8f"

How can I get rid of this redundant display?

To clarify, what I would like to see on the screen is only:

=INFO REPORT==== 8-Apr-2011::16:43:24 ===
    chan: ser_200
    usb_port
    send
    data: "6d e1 00 00 00 04 00 00 06 8f"

I'm not asking about writing it to a file. This is alredy done with the mf logger.

What I want to improve is the live display on the screen.

I'm starting Erlang like this:

erl +W w -boot start_sasl -config myconfig ...

Application config file looks like this:

[{sasl, [
    {sasl_error_logger, tty},   
    {error_logger_mf_dir,"./log"},  
    {error_logger_mf_maxbytes,10485760}, % 10 MB
    {error_logger_mf_maxfiles, 10}]}].
Peer Stritzinger
  • 8,232
  • 2
  • 30
  • 43

1 Answers1

2

Just found it out:

There was a overlooked catch all clause in one of my own error handlers left over from ancient times in another project:

handle_event(Event, State) ->
    io:format("~p\n", [Event]),

This cause the ~p like output ... because I'm using ~p.

Once I removed the io:format/2 call the double printing disappeared.

Peer Stritzinger
  • 8,232
  • 2
  • 30
  • 43