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

error message "logger:remove_handler(default) failed" printed at startup #507

Open
notslang opened this issue Jul 12, 2019 · 3 comments
Open

Comments

@notslang
Copy link

notslang commented Jul 12, 2019

I found a small issue where upgrading amqp_client from 3.7.13 to 3.7.14 causes an error message to be printed when I start up my Elixir application:

[error] calling logger:remove_handler(default) failed: :error {:badmatch, {:error, {:not_found, :default}}}

The error is being printed due to code introduced by this change, since lager is a dependency of amqp_client and was upgraded as a result of upgrading amqp_client. However, I have no idea if this is a defect in lager or if it's another dependency using lager incorrectly, and I'm not sure how to check.

I'm using Erlang/OTP 22, if that helps.

Is this the right place to report this?

@hauleth
Copy link

hauleth commented Sep 11, 2019

@notslang yes, this is due to fact that Elixir is also removing default handler if you have handle_otp_reports set to true (the default). So you have 2 options:

  • live with it
  • set handle_otp_reports to false

@jadencodes
Copy link

jadencodes commented Jan 2, 2020

This is a bit late, but I ran into the same thing; there is another potential fix for this mentioned at the bottom of the amqp client page. You need to add :lager to start before :logger. So your file will look something like this:

def application do
    [
      extra_applications: [:lager, :logger, :amqp]
    ]
end

Hope this is useful.

bnadlerjr added a commit to bnadlerjr/lightrail that referenced this issue Jan 19, 2021
Was seeing
`calling logger:remove_handler(default) failed: :error {:badmatch, {:error, {:not_found, :default}}}`
when running tests. According to a GitHub issue[1], the fix is to start
`lager` before `logger`.

[1]: erlang-lager/lager#507 (comment)
@linkdd
Copy link

linkdd commented Aug 26, 2021

For what it's worth, none of the above worked for me.

I'm using Elixir 1.12 / OTP 24. And this dependency overwrites the logger configuration.

When running mix test on my project, there should be no logging, but here it's printing so much I cannot see my test results anymore.

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

4 participants