[erlang-questions] log4erl as system logger

Damian Dobroczyński <>
Wed Jun 2 14:14:29 CEST 2010


W dniu 02.06.2010 12:13, Max Lapshin pisze:
> Hi. I want to use log4erl as a default error logger for all system (to
> log all process failures),
> but I don't understand how.
> 
> What part of erlang documentation have I missed? Where should I read
> to understand, how to change logger.
> 

error_logger is "gen_event" process registered locally under the name
"error_logger". The process start is hard-coded in the "kernel"
application (kernel.erl module implements "kernel_sup" supervisor
behavior - this supervisor launches the "error_logger" process) which is
loaded as the very first. What you can do is to kill this process as
soon as possible (risking that some logging messages would not reach the
logger) and replace it with another "gen_event" process registering it
under the name "error_logger". You may obtain this by launching special
application that starts only the specialized gen_event process (if you
want to use it in a boot script) or by passing a command line options
"-s <module_name>" which fires <module_name>:start/0 function. The
latter is launched after all primary application has been loaded, so the
initial logs would go through the standard error_logger. I think you
should write a special "launcher" module to replace the standard logger.
Besides log4erl must implements error_logger message protocol. I do not
know it is so.

Hope this helps,
Damian

> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20100602/05e0a2a8/attachment.bin>


More information about the erlang-questions mailing list