Bugsnag Rails v4.2 demo (with delayed_job)
This Rails application demonstrates how to use Bugsnag with Rails v4.2. Further details about integrating Bugsnag with Rack applications can be found here.
Configuring Bugsnag and Rails v4.2
There are two methods of configuring Bugsnag within a Rails application:
API_KEYcan be exported as an environment variable
Generate a bugsnag configuration file at
config/initializers/bugsnag.rbwhich can be populated with the available configuration options by running the rails command:
rails generate bugsnag YOUR_API_KEY_HERE
This is sufficient to start reporting unhandled exceptions to Bugsnag.
Running the example
Run the example using:
bundle exec rails server
Once the server is running head to the default path for more information on Bugsnag logging examples.
Running delayed job
To run the delayed job example you'll need to first run a database migration:
bundle exec rake db:migrate
This example comes packaged with a delayed job setup to demonstrate how errors are reported through delayed job. Once the rails setup is complete with an initializer at
config/initializers/bugsnag.rb you don't need to do anything else with delayed job, just run the examples!
The examples can be found at
In order to run the delayed job example:
- Open the rails console using the command:
bundle exec bin/rails console
- Queue up the examples you wish to run. At the moment there are two examples
notify, which are queued by passing the symbol to the
helper.test_dj :crash helper.test_dj :notify
- Exit the rails console using the
- Run the queue using rake:
bundle exec rake jobs:work