error logging with tty?

Richard Cameron camster@REDACTED
Wed Feb 8 18:01:55 CET 2006


On 8 Feb 2006, at 12:04, bryan rasmussen wrote:

> Hi, I was just wondering, the documentation on the error logger says:
>
> " The events are, by default, logged to tty"
> what are the non-defaults?

The error logger is a standard OTP gen_event manager. See section 4  
of the design principles documentation for details:

<http://erlang.se/doc/doc-5.4.12/doc/design_principles/part_frame.html>

> Is it at all possible to write error output to file. Is it possible to
> query a past error, as one would assume with normal concepts of
> logging?

You can add any event handler you like to it. You could either write  
your own (to log the data to a text file, send you an instant  
message, alert you on a pager, whatever), or you could use the  
standard log_mf_h which will dump out your log messages to a binary  
file on disk. It's then possible to browse reports using the rb  
module (report browser) which decodes the binary to something  
readable and lets you search for previous errors.

The easiest way to enable log_mf_h in your application is to put  
something like this in your config file:

[{sasl, [
          {error_logger_mf_dir,"/var/log/my_application"},
          {error_logger_mf_maxbytes,10485760}, % 10 MB
          {error_logger_mf_maxfiles, 10}
]}

See the SASL man page for more details.

Richard.



More information about the erlang-questions mailing list