The Erlang error logger is an event manager (see
Initially,
Also the SASL application, if started, adds its own event
handler, which by default writes supervisor, crash and progress
reports to tty. See
It is recommended that user defined applications should report
errors through the error logger, in order to get uniform reports.
User defined event handlers can be added to handle application
specific events. (
Warning events was introduced in Erlang/OTP R9C. To retain
backwards compatibility, these are by default tagged as errors,
thus showing up as error reports in the logs. By using
the command line flag
Sends a standard error event to the error logger.
The
1> error_logger:error_msg("An error occurred in ~p~n", [a_module]). =ERROR REPORT==== 11-Aug-2005::14:03:19 === An error occurred in a_module ok
If called with bad arguments, this function can crash
the standard event handler, meaning no further events are
logged. When in doubt, use
Sends a standard error report event to the error logger. The event is handled by the standard event handler.
2> error_logger:error_report([{tag1,data1},a_term,{tag2,data}]). =ERROR REPORT==== 11-Aug-2005::13:45:41 === tag1: data1 a_term tag2: data ok 3> error_logger:error_report("Serious error in my module"). =ERROR REPORT==== 11-Aug-2005::13:45:49 === Serious error in my module ok
Sends a user defined error report event to the error logger. An event handler to handle the event is supposed to have been added. The event is ignored by the standard event handler.
It is recommended that
Returns the current mapping for warning events. Events sent
using
os$ erl Erlang (BEAM) emulator version 5.4.8 [hipe] [threads:0] [kernel-poll] Eshell V5.4.8 (abort with ^G) 1> error_logger:warning_map(). error 2> error_logger:warning_msg("Warnings tagged as: ~p~n", [error]). =ERROR REPORT==== 11-Aug-2005::15:31:23 === Warnings tagged as: error ok 3> User switch command --> q os$ erl +W w Erlang (BEAM) emulator version 5.4.8 [hipe] [threads:0] [kernel-poll] Eshell V5.4.8 (abort with ^G) 1> error_logger:warning_map(). warning 2> error_logger:warning_msg("Warnings tagged as: ~p~n", [warning]). =WARNING REPORT==== 11-Aug-2005::15:31:55 === Warnings tagged as: warning ok
Sends a standard warning event to the error logger.
The
If called with bad arguments, this function can crash
the standard event handler, meaning no further events are
logged. When in doubt, use
Sends a standard warning report event to the error logger.
The event is handled by the standard event handler. It is
tagged either as an error, warning or info, see
Sends a user defined warning report event to the error
logger. An event handler to handle the event is supposed to
have been added. The event is ignored by the standard event
handler. It is tagged either as an error, warning or info,
depending on the value of
Sends a standard information event to the error logger.
The
1> error_logger:info_msg("Something happened in ~p~n", [a_module]). =INFO REPORT==== 11-Aug-2005::14:06:15 === Something happened in a_module ok
If called with bad arguments, this function can crash
the standard event handler, meaning no further events are
logged. When in doubt, use
Sends a standard information report event to the error logger. The event is handled by the standard event handler.
2> error_logger:info_report([{tag1,data1},a_term,{tag2,data}]). =INFO REPORT==== 11-Aug-2005::13:55:09 === tag1: data1 a_term tag2: data ok 3> error_logger:info_report("Something strange happened"). =INFO REPORT==== 11-Aug-2005::13:55:36 === Something strange happened ok
Sends a user defined information report event to the error logger. An event handler to handle the event is supposed to have been added. The event is ignored by the standard event handler.
It is recommended that
Adds a new event handler to the error logger. The event
handler must be implemented as a
The event handler must be able to handle the
Deletes an event handler from the error logger by calling
Enables (
This is done by adding or deleting the standard event handler
for output to tty, thus calling this function overrides
the value of the Kernel
Enables or disables printout of standard events to a file.
This is done by adding or deleting the standard event handler
for output to file, thus calling this function overrides
the value of the Kernel
Enabling file logging can be used in combination with calling
Opens the log file
Closes the current log file. Returns
Returns the name of the log file
All event handlers added to the error logger must handle
the following events.
Generated when
Generated when
Generated when
Generated when
Generated when
Generated when
Generated when
Generated when
Generated when
Note that also a number of system internal events may be
received, a catch-all clause last in the definition of
the event handler callback function
gen_event(3), log_mf_h(3), kernel(6), sasl(6)