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

Silence the ready message #283

Closed
csuhta opened this issue Mar 4, 2016 · 2 comments
Closed

Silence the ready message #283

csuhta opened this issue Mar 4, 2016 · 2 comments

Comments

@csuhta
Copy link

csuhta commented Mar 4, 2016

I have this config for a Rails app and bugsnag 3.0.0:

Bugsnag.configure do |config|
  config.api_key = ENV.fetch("BUGSNAG_API_KEY")
  config.app_type = "rails"
  config.notify_release_stages = ["production"]
  config.send_environment = true
  config.use_ssl = true
end

Bugsnag prints this message for everything the Rails app does (boot, rake, rails, migrations, test suite, etc):

** [Bugsnag] Bugsnag exception handler 3.0.0 ready, api_key=[snip]

We want bug capture for production rake tasks, but we don't want this message in the logs every single time the Rails app initializes, especially since it contains the API key. Is there some way to silence this message?

@kattrali
Copy link
Contributor

Thanks for the report, @csuhta. I updated the ready message to remove the API key. The message is displayed at the info log level, could the logging level potentially be turned up for running tests, etc?

@csuhta
Copy link
Author

csuhta commented Sep 4, 2016

Would you explain the proper way to turn up the logging level or silence Bugsnag when BUGSNAG_API_KEY is set in the environment?

The gem auto-configures itself from the environment when it gets require-ed. You don't have an opportunity to silence it from a Rails initializer.

Here's an example:

# config/initializers/bugsnag.rb
puts "Bugsnag initializer reached"
Bugsnag.configure do |config|
  config.logger = Logger.new("/dev/null")
  config.api_key = ENV.fetch("BUGSNAG_API_KEY")
  config.app_type = "rails"
  config.notify_release_stages = ["production"]
  config.send_environment = true
  config.use_ssl = true
end

The message gets logged before you can configure Bugsnag:

$ rails c
** [Bugsnag] Bugsnag exception handler 5.0.0 ready
Bugsnag initializer reached
Loading development environment (Rails 5.0.0.1)

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