Full-Stack Error Monitoring

Rollbar is platform-agnostic and can accept data from anything that can speak HTTP and JSON. You can use our official libraries for RubyPythonPHPNode.jsJavaScriptAndroidiOS, or Flash, community libraries for Go, Clojure, Dart, Erlang, Haskell, Java, .NET, or ColdFusion, or roll your own with our API.

Integration for our official libraries is only a few lines of code or configuration to drop in. For high-traffic websites, we also offer a server-side agent, rollbar-agent, for higher throughput and out-of-band uploading.

Uncaught exception handlers

Most of our official libraries install a top-level exception handler to seamlessly report uncaught exceptions to Rollbar. Once you configure the library, no further work is required on your part.

Logging exceptions by hand

Each library also supports reporting exceptions manually (i.e. that you caught in a try-catch).

begin
  foo(bar)
rescue Exception => e
  Rollbar.error(e)
  # or add your own message and custom params:
  Rollbar.error(e, "Something went wrong while fooing the bar", :bar => bar)
end
try:
  foo(bar)
except:
  rollbar.report_exc_info()
  # or if you have request object, pass that as well:
  # (django, flask, pyramid, tornado, bottle, werkzeug, webob)
  rollbar.report_exc_info(request=request)
  # can also pass additional params
  rollbar.report_exc_info(request=request, extra_data={'bar': bar})
<?php
try {
  throw new Exception('test exception');
} catch (Exception $e) {
  Rollbar::report_exception($e);
}
try {
  foo(bar);
} catch (e) {
  rollbar.handleError(e);
  // or if you have the request object
  rollbar.handleError(e, req);
  // or if you have extra params
  rollbar.handleErrorWithPayloadData(e, {custom: {bar: bar}}, req);
}
try {
  foo(bar);
} catch (e) {
  Rollbar.error(e);
  // or add your own message and params:
  Rollbar.error(e, "Something went wrong while fooing the bar", {bar: bar});
}
try {
  foo(bar);
} catch (err:Error) {
  Rollbar.handleError(err);
}

Logging things that aren't exceptions

You can send any log message to Rollbar, not just exceptions. Log messages can have the same attached metadata as exceptions (request, server, person, etc.) and go through a similar de-duplication process as exceptions.

Log messages have a level (criticalerrorwarninginfo, or debug), a body (just a string), and any arbitrary optional parameters you want to include.

# log methods exist for each level, or pass as a param
Rollbar.critical("Crash while processing payment")
Rollbar.log("error", "Crash while checking order status")
Rollbar.warning("Facebook API unavailable")
Rollbar.info("User logged in")
Rollbar.debug("Cron job starting")

# can pass arbitrary params
Rollbar.info("User logged in", :login_type => "email+password")

# rich metadata will be included automatically, but if you want to override:
Rollbar.scope(person => {:id => "123"}).info("User logged in")
# default level is 'error'
rollbar.report_message('Got an IOError in the main loop')

# logs at the 'warning' level
rollbar.report_message('Got an IOError in the main loop', 'warning')

# can also include the request object
rollbar.report_message('Got an IOError in the main loop', 'warning', request)

# or extra context
rollbar.report_message('Got an IOError in the main loop', 'warning', extra_data={'job_id': job_id})
<?php
// default level is 'error'
Rollbar::report_message('Could not connect to database');

// logs as the 'warning' level
Rollbar::report_message('Could not connect to Facebook API', 'warning');
// default level is 'error'
rollbar.reportMessage("Could not connect to database");

// logs at the 'warning' level
rollbar.reportMessage("Could not connect to memcache", "warning");
// log methods exist for each level, or pass as a param
Rollbar.critical("Crash while processing payment");
Rollbar.log("error", "Crash while checking order status");
Rollbar.warning("Facebook API unavailable");
Rollbar.info("User logged in");
Rollbar.debug("Cron job starting");

# can pass arbitrary params
Rollbar.info("User logged in", {login_type: "email+password"});

# rich metadata will be included automatically, but if you want to override:
Rollbar.scope({person: {id: "123"}}).info("User logged in");

For more details, please see our documentation.