cth_readable_logger does not exist
tothlac opened this issue · 3 comments
I use v1.4.9. In cth_readable_failonly:call_handlers/2 has_logger is cth_readable_logger.
In the next line that handler is called with
gen_event:call(Name, Handler, Msg, 300000)
I've the following error if I put this into a try/catch:
cth_readable_failonly 350 {Error, Stack}: '{{noproc,
{gen_event,call,
[cth_readable_logger,
cth_readable_failonly,flush,
300000]}},
[{gen_event,call1,4,
[{file,"gen_event.erl"},
{line,302}]},
{cth_readable_failonly,
'-call_handlers/2-lc$^0/1-0-',3,
[{file,
"rds/_build/test/lib/cth_readable/src/cth_readable_failonly.erl"},
{line,348}]},
{cth_readable_failonly,
call_handlers,2,
[{file,
"rds/_build/test/lib/cth_readable/src/cth_readable_failonly.erl"},
{line,354}]},
Because of this my tests are failing. When I was debugging it I saw cth_readable_logger was added
using gen_event:handler in adding_handler function before this error.
Do you have an idea what could happen with that process? Have you seen something like this?
The handler is added at https://github.com/ferd/cth_readable/blob/master/src/cth_readable_failonly.erl#L312-L315 -- one of the reasons it wouldn't be there is that the common test hooks are not run properly, then this will not be set up to be used. Another reason for this to happen is that something dynamically removes the logging handlers during one of the tests?
I guess a last possibility is that you're using cth_readable but haven't chosen the failonly option or something, which sets up the logging handlers, but the parse transform to overwrite ct:pal
into cthr:pal
is still called. Either the failonly handler needs to be configured, or I think there needs to be a check in these calls: https://github.com/ferd/cth_readable/blob/master/src/cthr.erl#L70-L75 to capture the existence of the handler.
You were right. Someone was calling this in the main repository. I think it was the only reason:
logger:internal_init_logger(),
The ticket can be closed.