report browser and error_logger
Hal Snyder
hal@REDACTED
Mon Jan 21 02:27:05 CET 2002
Martin Bjorklund <mbj@REDACTED> writes:
> Since I implemented this in OTP, I've done some rethinking - why
> bother to store the logs in binary format anyway? In most cases it's
> better to store the error log in plain text, but using a wrap log so
> the log won't grow. This is what we do in our systems.
>
> I've attached disk_log_h, a module which should have been
> implemented years ago. It's a gen_event handler for disk_log. This
> handler can be used e.g. for an error log, or whatever. This module
> could very well be part of OTP (it's intended to be).
Great! This looks quite interesting.
One small question, however. Attempts to use disk_log_h result in
event handler crashes. Is it correct that disk_log:do_log/2 returns an
integer? It returns 1 in the tests, and disk_log_h doesn't seem to
like that.
Also, what would be a good way to flush cached log entries to disk?
Hope I'm not being a pest.
The setup:
1. Using kit built from otp_src_R8B-20011015 plus the disk_log
patch you provided.
2. Then in a directory where disk_log_h.beam and logger.beam exist,
start an erl node as follows.
>erl
Erlang (BEAM) emulator version 5.1 [source]
Eshell V5.1 (abort with ^G)
1> logger:add_error_logger_mf("/tmp/glotz", 10000, 4, all).
ok
2> error_logger:error_msg("foo~n").
ok
=ERROR REPORT==== 20-Jan-2002::18:05:05 ===
foo
3>
=ERROR REPORT==== 20-Jan-2002::18:05:05 ===
** gen_event handler {disk_log_h,logger} crashed.
** Was installed in error_logger
** Last event was: {error,<0.21.0>,{<0.23.0>,"foo~n",[]}}
** When handler state == {state,{log,ok,
logger,
none,
0,
"/tmp/glotz",
[],
wrap,
external,
wrap_ext,
none,
read_write,
{10000,4},
{handle,
"/tmp/glotz",
10000,
4,
0,
1,
{cache,
{file_descriptor,
prim_file,
{#Port<0.32>,3}},
0,
[]},
"/tmp/glotz.1",
0,
0,
0,
0,
0}},
0,
{logger,form_all}}
** Reason == 1
More information about the erlang-questions
mailing list