[erlang-questions] Suppressing error_logger output in escript

Dmitry Klionsky dm.klionsky@REDACTED
Fri Jul 18 10:58:55 CEST 2014


On 07/18/2014 11:01 AM, Frans Schneider wrote:
> Hi list,
>
> In my code I use some error_logger:info_msg's for debugging, which is 
> great. Using escript, I implemented a few command line tools. The 
> output of these tools is cluttered with the debugging output from the 
> main program code. How can I suppress the info messages?
> I tried starting SASL and setting sasl_error_logger to {file, 
> "/dev/null"} as in:
>
> #!/usr/bin/env escript
> %% -*- erlang -*-
> %%! -pa deps/getopt/ebin
>
> -mode(compile).
>
> main() ->
>     ...
>     application:load(sasl),
>     application:set_env(sasl, sasl_error_logger, {file, "/dev/null"}),
>     application:start(sasl),
>     ...start main program...
>
> but the messages keep coming.
> According to the kernel documentation, suppressing error_logger output 
> can also be done by setting error_logger to silent.
>
> Any suggestions?
>
> Frans
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Have you tried error_logger:tty(false) ?
http://erlang.org/doc/man/error_logger.html#tty-1

-- 
Best regards,
Dmitry Klionsky




More information about the erlang-questions mailing list