[erlang-questions] Lots of questions about error_logger

Sergey A. n39052@REDACTED
Fri Oct 10 17:09:14 CEST 2008


In the first place, sorry for several different questions placed in
one letter. I know it's something wearily to answer a list of

I tried using error_logger as a tool for handling error reports and
I've came across some oddities:

#1. Is there a way to set SASL options (I'm about sasl_error_logger,
errlog_type etc) from the Erlang code at runtime without using a
.config file + the "-config" argument? I just want to give an end user
only one config file to edit and use values from that to setup SASL.

#2. The following is from the "Programming Erlang":

--[Beginning of quote]-------------------------------------------------
The next configuration file lists error reports in the shell, and a copy of
everything reported in the shell is also made to a file:

%% single text file - minimal tty
[{sasl, [
             %% All reports go to this file
             {sasl_error_logger, {file, "/home/joe/error_logs/THELOG" }}
--[End of quote]-------------------------------------------------

I replaced the path to just "THELOG" and then run the shell:

--[Beginning of erl session]-------------------------------------------------
erl -boot start_sasl -config elog2.config

Erlang (BEAM) emulator version 5.6.3 [source] [smp:2]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6.3  (abort with ^G)
1> error_logger:error_msg("foobar~n").

=ERROR REPORT==== 10-Oct-2008::03:19:38 ===
2> error_logger:error_report("foobar\n").

=ERROR REPORT==== 10-Oct-2008::03:21:05 ===

User switch command
 --> q
--[End of erl session]-------------------------------------------------

But after all, THELOG doesn't contain any string related to my
foobar-errors! Just only progress reports! Why does this happen?

#3. If I decide to use rotating of logs, those logs will be written in
binary format. What are the benefits of using binary format for
storing logs? Is there possibility to force Erlang to use plain text
files instead of binary ones?

#4. What is the "index" file for?

#5. Quote from Programming Erlang:
--[Beginning of quote]-------------------------------------------------
In a production environment, we are really interested only in errors and
not progress or information reports, so we tell the error logger to report
only errors. Without this setting, the system might get swamped with
information and progress reports.
 Download elog4.config
%% rotating log and errors
[{sasl, [
             %% minimise shell error logging
             {sasl_error_logger, false},
             %% only report errors
             {errlog_type, error},
             %% define the parameters of the rotating log
             %% the log file directory
             {error_logger_mf_dir,"/home/joe/error_logs" },
             %% # bytes per logfile
             {error_logger_mf_maxbytes,10485760}, % 10 MB
             %% maximum number of
             {error_logger_mf_maxfiles, 10}
--[End of quote]-------------------------------------------------

But using this config I see some progress reports:

3> rb:list().
  No                Type   Process       Date     Time
  ==                ====   =======       ====     ====
   6            progress  <0.30.0> 2008-10-10 03:39:59
   5            progress  <0.30.0> 2008-10-10 03:39:59
   4            progress  <0.30.0> 2008-10-10 03:39:59
   3            progress  <0.30.0> 2008-10-10 03:39:59
   2            progress  <0.23.0> 2008-10-10 03:39:59
   1               error  <0.24.0> 2008-10-10 03:40:20

What is wrong?


P.S. Sorry for the possible English mistakes in my letter =)

More information about the erlang-questions mailing list