Installing Airbrake in a Rails application
Airbrake gem vs Airbrake Ruby
The Airbrake gem: Acts as a collection of integrations with frameworks and other libraries and is built on top of Airbrake Ruby.
Airbrake Ruby: The core library that performs exception sending, filtering sensitive values, ignoring errors, managing the configuration, and other heavy lifting.
We link to both projects in this guide and want to be clear about their responsibilities.
Integrating Airbrake in your Rails app
Install the Airbrake gem
Open up your
Gemfile in your favorite text editor and add the
NOTE: This version could be out of date, the README will always have the correct version.
To install the Airbrake gem, run from the root directory of your application.
Configure the Airbrake gem to report to your project
This generation command is meant to be run from the root directory of your application.
INFO: This creates the
config/initializers/airbrake.rbfile containing your
PROJECT_KEYalong with some common config options and descriptions.
Additional configuration options are detailed in the airbrake-ruby README.
Testing your configuration
The following rake command to sends a test exception to verify your app’s configuration.
HELP: If you don’t see the locate link, please email the complete output of
rake airbrake:testto email@example.com.
You can choose which errors to ignore before sending them to Airbrake with the
This makes it simple to ignore errors based on type, message, file, region, or
any other part of the error’s
For example, to ignore all
StandardErrors you could use the following
TIP: A good place to keep your
add_filters is below your
You can use
to specify keys to filter out of the payload
session, etc). Before sending an
error, filtered keys will be substituted with the
Please see our guide on Installing airbrake-js in a Rails app for full details.
With deploy tracking you can send information about the deployment of your app to Airbrake. This unlocks error filtering by deploy and deploy markers are added to your error graphs.
We offer several ways to track your deploys:
- Deploy tracking with the Rake task
- Deploy tracking with Capistrano
- Deploy tracking guide
- Deploy tracking API (create, list, show)
Since it’s not all about Rails, here are some of our favorite supported ruby frameworks:
- Rack applications
- Our guide for appending info from Rack requests is applicable to all Rack apps (including Rails).
Job processing libraries
More information available on GitHub
Please visit the Airbrake gem repo for more configuration options, use cases, examples, and tips.
Looking for the Heroku guide?
If so, you may prefer Getting started with Airbrake, Rails, & Heroku, in which you will create a new rails app on heroku that integrates with airbrake.