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 the terminal. See
It is recommended that user-defined applications report
errors through the error logger to get uniform reports.
User-defined event handlers can be added to handle application-specific
events, see
Warning events were introduced in Erlang/OTP R9C and are enabled
by default as from Erlang/OTP 18.0. To retain backwards compatibility
with existing user-defined event handlers, the warning events can be
tagged as
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 events in this module, see
section
Deletes an event handler from the error logger by calling
Sends a standard error event to the error logger.
The
Example:
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
If the Unicode translation modifier (
Sends a standard error report event to the error logger. The event is handled by the standard event handler.
Example:
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
Sends a standard information event to the error logger.
The
Example:
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
If the Unicode translation modifier (
Sends a standard information report event to the error logger. The event is handled by the standard event handler.
Example:
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
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 together with calling
Opens log file
Closes the current log file. Returns
Returns the name of the log file
Enables (
This is done by adding or deleting the standard event handler
for output to the terminal. Thus, calling this function overrides
the value of the Kernel
Returns the current mapping for warning events. Events sent
using
Example:
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(). 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 3> User switch command --> q os$ erl +W e 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
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
If the Unicode translation modifier (
Sends a standard warning report event to the error logger.
The event is handled by the standard event handler. It is
tagged 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 as an error, warning, or info,
depending on the value of
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
Notice that some system-internal events can also be
received. Therefore a catch-all clause last in the definition of
the event handler callback function