[erlang-questions] error_logger and the perils of asynchronicity
Fri May 15 14:45:54 CEST 2009
I agree that error_logger, specifically the standard
error_logger_file_h, needs enhancements. I have come across the same
issue with log4erl , in which I came across the same issue, and
come to the conclusion that async messages to a primarily IO-bound
process is a bad thing. I thought about adding some kind of persistent
queue as means of communication but it's just easier to use
I don't like the idea of mangling or dropping logging messages
because, having worked with telecom systems, I believe each one is a
view to the system that can be essential. I'd rather to slow down the
system than to mess with them. But, I know many will disagree.
BTW, in the latest log4erl, use sync logging and you can forward all
your error_logger requests to log4erl and get it processed by log4erl.
You can check the latest log4erl in .
On Fri, May 15, 2009 at 2:07 AM, BranchingFactor
> You could add a maximum-delay configuration option to the log file system. As the error messages come in, you timestamp them. Any message that sits in the queue for longer than the maximum-delay will get removed and a message will be printed saying how many such messages were purged.
> --- On Thu, 5/14/09, Per Melin <> wrote:
>> From: Per Melin <>
>> Subject: Re: [erlang-questions] error_logger and the perils of asynchronicity
>> To: ,
>> Date: Thursday, May 14, 2009, 5:23 PM
>> Marc Sugiyama:
>> > In thinking specifically about error_logger, one
>> solution might be to
>> > have it check its queue and shed work when it is
>> overloaded. For
>> > example, it could shed work by:
>> > 1. dumping unformatted messages into the log rather
>> than formatted messages.
>> > 2. abandoning a message and noting in the log that it
>> lost a message.
>> > 3. abandoning messages with no record.
>> > More generally, some library support for detecting
>> > processes might be helpful. I suspect there are
>> several strategies
>> > for doing so (e.g., checking the message queue length.
>> time to process
>> > the message queue, etc.).
>> I'm working on a handler that plugs into error_logger but
>> some of the issues I've had with error_logger, and also
>> adds some
>> features that I really miss (like date-based log file
>> I use strategy 2 from your list, throwing away messages but
>> noting it
>> in the log once it catches up. My problem is finding
>> strategies for detecting that we are falling behind.
>> I do the writing to disk in a separate process, and detect
>> flooding by
>> keeping a count of queued up messages waiting to be
>> written. Looking
>> at the size, instead of the length, of the queue would be
>> much better,
>> but I don't know any (fast) way to do that.
>> erlang-questions mailing list
> erlang-questions mailing list
More information about the erlang-questions