Monitor errors from any platform

Rollbar is platform-agnostic and can accept data from anything that can speak HTTP and JSON. You can use our official libraries for Ruby, Python, PHP, Node.js, JavaScript, or Flash, 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.

Top-level exception handlers

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

Platform Hook used
Rails Wraps render_exception
Django Works as a middleware that defines process_exception
Pyramid Adds a tween under EXCVIEW
PHP Installs handlers using set_exception_handler and set_error_handler
Node.js Provides Express error handling middleware and a standalone library to handle UncaughtException events
JavaScript Attaches as handler for window.onerror
Flash Adds a listener for UncaughtErrorEvent.UNCAUGHT_ERROR

Logging exceptions by hand

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

# in a controller method
begin
  foo = bar
rescue Exception => e
  Rollbar.report_exception(e, rollbar_request_data, rollbar_person_data)
end

# anywhere you have a rails context
begin
  foo = bar
rescue Exception => e
  Rollbar.report_exception(e)
end
try:
    do_something()
except:
    rollbar.report_exc_info(sys.exc_info())
    # or if you have a webob, django, or werkzeug request object, pass that as well:
    rollbar.report_exc_info(sys.exc_info(), request)
<?php
try {
    throw new Exception('test exception');
} catch (Exception $e) {
    Rollbar::report_exception($e);
}
try {
    doSomething();
} catch (e) {
    rollbar.handleError(e);
    // or if you have the request object
    rollbar.handleError(e, req);
}
try {
    do_something();
} catch (e) {
    _rollbar.push(e);
}
try {
  doSomething();
} 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 (critical, error, warning, info, or debug), a body, and any arbitrary optional parameters you want to include.

# default level is 'info'
Rollbar.report_message("Login successful")

# logs at the 'warning' level.
Rollbar.report_message("Unexpected input", "warning")

# can also include additional data as a hash in the final param
Rollbar.report_message("Login successful", "info", :user => @user)
# 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)
<?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");
// A plain string
_rollbar.push("Some log message");

// A customized log message with an extra "point" param
_rollbar.push({level: 'warning', msg: "Some warning message", point: {x: 5, y: 10}});

For more details, please see our documentation.