Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cth_readable_logger does not exist #40

Closed
tothlac opened this issue Jul 18, 2022 · 3 comments
Closed

cth_readable_logger does not exist #40

tothlac opened this issue Jul 18, 2022 · 3 comments

Comments

@tothlac
Copy link

tothlac commented Jul 18, 2022

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?

@ferd
Copy link
Owner

ferd commented Jul 18, 2022

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.

@tothlac
Copy link
Author

tothlac commented Jul 18, 2022

You were right. Someone was calling this in the main repository. I think it was the only reason:

      logger:internal_init_logger(),

@tothlac
Copy link
Author

tothlac commented Jul 18, 2022

The ticket can be closed.

@tothlac tothlac closed this as completed Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants