[erlang-questions] Logger which truncates too big terms

Andrew Thompson andrew@REDACTED
Fri Dec 2 16:55:42 CET 2011

On Fri, Dec 02, 2011 at 06:02:03PM +0300, Max Lapshin wrote:
> No logger can reduce messages with current state of OTP.
> https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747
> this is where you need to move to protect your system from silly OOM
> while printing error message.

In an ideal world yes, you'd do it here. Happily, passing a large term
around and formatting it as a string are 2 different things, and you
can at least mitigate some of the damage by truncating it downstream.

As regards modifying log messages, lager does do a significant amount of
that, I agree. However, I didn't do that lightly, it was done so the
logger can't ever crash the node, and to provide more human-readable
log messages based on the ones output from SASL, for customers using an
erlang service who aren't erlang programmers themselves (the original
log messages are also preserved, just in a different file).

Lager just meets the needs we had at basho for riak logging in
production, there's plenty of alternatives with other design
decisions/tradeoffs, but it's worked out very well for us so far.


More information about the erlang-questions mailing list