How do I configure the Airbrake gem to log all Rails exceptions in both development and production environments?

Alan David Garcia picture Alan David Garcia · Sep 27, 2011 · Viewed 9.2k times · Source

I have found it difficult to send exceptions of my Rails 3 app via the Airbrake gem. At first I thought there was an Airbrake configuration error on my part, but after trial and error and reading the documentation (https://github.com/thoughtbot/airbrake#readme) very closely, I found out that Airbrake does not report errors when an app is running in the development environment. It does report errors when the app is running in the production environment.

Is there a flag to generate an Airbrake configuration file that automatically includes the development environment in the list of environments in which notifications should not be sent?

Currently I am executing the command listed in the README

script/rails generate airbrake --api-key your_key_here

Answer

StuFF mc picture StuFF mc · Oct 18, 2011

Straightforward.

  config.consider_all_requests_local       = false

instead of

  config.consider_all_requests_local       = true

in your config/environments/development.rb. In my case, like I suspect in many others, it was just a temporary change so I can "test" Airbrake's notify_airbrake.

You do need config.development_environments = [] in airbrake.rb