[erlang-questions] Suppressing error_logger output in escript

Frans Schneider schneider@REDACTED
Fri Jul 18 10:01:00 CEST 2014


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



More information about the erlang-questions mailing list