Erlang (OTP 21+) Logger Console Output Question (Garbled Prompt)

Nicolas Martyanoff khaelin@REDACTED
Mon May 10 10:13:20 CEST 2021


Stanislav Ledenev <s.ledenev@REDACTED> writes:

>>
>> If I'm not mistaken, this is also the reason eunit tests do not capture
>> logger messages, making it hard to understand what was logged by a
>> specific failing test.
>
> What do you mean by "eunit doesn't capture logger messages"?
> Is it some specific case?
> I have had some problems with capturing messages but it was my fault -
> I misspointed the config file with logger_level set higher than the
> category of my messages.
> And another issue was with common_test.
> You must enable verbose output to be able to see messages.

Eunit introduces its own group leader for each test case, capturing
printed messages, and displaying them in a small section associated with
each failing test. This is really useful when trying to understand why a
specific test failed.

But logger messages are not directly sent to the group leader, therefore
they are not captured by eunit and are logged in all cases. This is a
problem because it is now really hard to understand what was logged
(especially which errors) in each failing test.

This is clearly a design issue: eunit was not taken into account when
logger was introduced.

I tried to work around it with custom log handlers in the past, but
could never make it work, and I remember talking about it on #erlang,
but the conclusion was that it was not fixable without patching eunit
and/or logger.

-- 
Nicolas Martyanoff
http://snowsyn.net
khaelin@REDACTED


More information about the erlang-questions mailing list