Ruby Exception Tracking
Typical installation time: 3 minutes
Hi there! You've found Honeybadger's guide to Ruby exception tracking. Once installed, Honeybadger will automatically report exceptions wherever they may happen:
- During a web request
- In a background job
- In a rake task
- When a process crashes (
If you're new to Honeybadger, read our Getting Started guide to become familiar with our Ruby gem. For a refresher on working with exceptions in Ruby, check out the Honeybadger guide to Ruby exceptions.
On this page:
The first step is to add the honeybadger gem to your Gemfile:
Tell bundler to install:
$ bundle install
Next, you'll set the API key for this project.
$ bundle exec honeybadger install [YOUR API KEY HERE]
This will do three things:
- Generate a
config/honeybadger.ymlfile. If you don't like config files, you can place your API key in the
- If Capistrano is installed, we'll add a require statement to Capfile.
- Send a test exception to your Honeybadger project.
Next, require the honeybadger gem after any other gems you're using:
# ... require 'honeybadger'
Honeybadger will detect any supported 3rd-party gems you're using such as Sidekiq, Rake, etc. and integrate with them automatically.
To notify Honeybadger of an exception you've rescued, use
begin fail 'oops' rescue => exception Honeybadger.notify(exception) end
For Rack-based web applications, see the Rack integration guide for instructions on how to automatically report exceptions in web requests.