[erlang-questions] error_logger heap overflow

Bogdan Andu <>
Mon Jan 7 10:01:26 CET 2013


Sorry for delayed response.

Unfortunately, I cannot use the work around presented because is experimental and the system is ready to be launched into production, so I cannot anymore switch back to lager, although is more heap overflow resistant than error_logger is.

I stick with error_logger because errors are easier to read and I am accustomed with it.


log rotation is solved with newsyslog.


What makes lager's messages 'hard to read' is the lack of error formatting.


What I would expect from lager:
1.     lager:notice() send the message in /var/log/notice_log
        lager:error() send the message in /var/log/error_log
        lager:info() send the message in /va/log/info_log
2. crash messages to appear only in /var/log/crash_log
3. this sould be configurable
4. more error formatting, like error_log has, in order to be easier to read


Why I want that? Because error has higher priority that notice, so all messages founded in /var/log/error_log are also founded in 
/var/log/notice_log. I do not want duplicated error messages even if they are truncated.

Bogdan




----- Original Message -----
From: Andrew Thompson <>
To: 
Cc: Bogdan Andu <>
Sent: Wednesday, November 28, 2012 8:47 AM
Subject: Re: [erlang-questions] error_logger heap overflow

On Tue, Nov 20, 2012 at 03:28:57AM -0800, Bogdan Andu wrote:
> I used that, lager, but it is hard to read error messages, and the errors are duplicated across all log files.
> 
> One cannot say to lager: commit notice messages to /var/log/notice_log, because all error messages with higher prority get written there, too.

I decided to tinker around this week in relation to this issue and came
up with this:

https://github.com/basho/lager/pull/95

Does that address your concern on that front?

> I like how error_logger prints the errors and I am used to it.
> 
> Please give me an advice of how to overcome this situation.
> 

One thing you could do would be to fork the stdlib (or SASL)
error_logger gen_event handlers to use lager_format instead of io_lib
(lager_format is a fork of io_lib with size based truncation added to
avoid the OOM issues). The only downside to this is that lager_format
currently lacks the line-wrapping support ~p and friends have in io_lib,
so stacktraces, for example, end up on one big line rather than being
line wrapped nicely.

Also, with regard to lager and formatting OTP errors, lager will try to
rewrite common OTP errors into more 'friendly' log messages, but it will
also write a truncated version of the original log format to the
'crash.log', if more information is required.

Finally, if you could give me more information on what makes lager's
messages 'hard to read', I'd appreciate it. Maybe some improvements can
be made.

Hope that helps,

Andrew




More information about the erlang-questions mailing list