Web
Article

How to Improve Your Team’s Debugging Times with Rollbar

By Craig Buckler

Real-world debugging

This article was sponsored by Rollbar. Thank you for supporting the sponsors who make SitePoint possible.

As a SitePoint reader, you write perfect error-free code on every project…

But can you say the same for every member of your team?

The more sophisticated your product, the larger your team and the more bugs you’ll discover. You may have robust testing procedures, but can you be sure the latest edition of your framework is error-free? What about third-party modules, databases and components? Is the language or runtime perfect? Are you certain about the underlying deployment Operating System? Can the whole stack be considered fool-proof for the most foolish of users?!

Understanding that errors are inevitable is the first step. The considerably more complex second step is recording errors, tracking frequencies, prioritizing issues, coding a solution, testing the fixes and deploying to a live server. Without careful management, teams can spend longer fixing bugs than writing new code.

Fortunately, Rollbar can drastically reduce debugging time and costs. The service is trusted by companies such as Heroku, Walmart, LogMeIn, Lyft, Twitch and Intuit to centrally manage critical errors on web sites, web applications, mobile and desktop apps.

At the time of writing, Rollbar has logged almost 13 billion errors (and that’s just my shoddy code!).

Debugging the Rollbar Way

Rollbar unites your tools into one seamless error-handling workflow. A few minutes of set-up can save considerable effort over the longer term.

1. Sign Up

Sign up from the Rollbar home page for an initial free trial. You can use an email address or link your GitHub account.

A quick set-up guide runs the first time you log in.

2. Create a New Project

Enter a project name and choose from one of the many languages and frameworks. All popular mobile, desktop and web back and front-end platforms are available.

Create a New Project

On creation, your project is assigned a unique access token which identifies all messages sent to the Rollbar system.

3. Integrate Rollbar into Your Project

Integration will vary according to your project’s language. For PHP, you can install a Rollbar component using Composer or by downloading two files. Include rollbar.php, initialize and send a test message:

<?php
// include Rollbar component
require_once 'rollbar.php';

// initialize Rollbar
Rollbar::init(array('access_token' => 'your-project-token'));

// send a test message
Rollbar::report_message('testing 123', 'info');

You can then add one or more exception handlers to capture all errors:

// catch exception and send to Rollbar
try {
  throw new Exception('test exception');
} catch (Exception $e) {
  Rollbar::report_exception($e);
}

For Node.js Express projects, you can install the Rollbar module using npm:

npm install --save rollbar

Then add Rollbar error-handling middleware:

var 
  rollbar = require('rollbar'),
  express = require('express'),
  app = express();

// Rollbar middleware
app.use(rollbar.errorHandler('your-project-token'));

// basic route
app.get('/', function (req, res) {
  res.send('Hello World!');
});

// start server
app.listen(3000);

Rollbar provides notification libraries for Android, Clojure, ColdFusion, Dart, Erlang, Flash, Go, Haskell, iOS, Java, JavaScript (client), .NET, Node.js, PHP, Python, Ruby and web server logs. Alternatively, you can use the fully documented RESTful API for other languages.

4. Access Your Rollbar Dashboard

The Rollbar dashboard provides a live overview of all errors with the frequency of occurrence:

Access Your Rollbar Dashboard

You can analyze individual issues to:

  • track the users, devices and browsers affected
  • locate similar or related errors
  • discuss the issues with other team members, and
  • replay web service calls to reproduce the same error.

From the Settings panel you can also:

  • add further team collaborators
  • apply grouping rules to reduce noise, and
  • connect other services…

5. Connect Other Services

Team members will have differing notification and issue-tracking preferences. Rollbar allows you send alerts and tasks via a range of popular channels including email, GitHub issues, BitBucket issues, JIRA, Pivotal Tracker, Trello, PagerDuty, Slack and more:

Connect Other Services

You can assign a developer to a task from the dashboard and know it has been updated in their bug-tracking tool of choice.

6. Fix and Deploy

Finally, Rollbar can be integrated with deployment platforms such as Heroku, Capistrano, Engine Yard and Fabric. Rollbar monitors the deployed fixes and marks issues as “resolved” on all connected services.

Not every fix goes to plan, so Rollbar will alert you immediately whenever a historical regression occurs.

Key Rollbar Features

Rollbar supports:

  • a wide range of languages and frameworks
  • all popular messaging systems
  • the most-used deployment platforms
  • instant error reporting
  • installation on your own premises
  • guaranteed privacy

Should you need more convincing…

Easy Integration

Rollbar can be integrated into your web, desktop or mobile application in minutes. It’ll be quicker than it took to read this article!

Excellent Documentation

I wish all documentation was as good as Rollbar’s! The guides are well-organized, concise and provide plenty of examples in all languages.

The RESTful API guide is essential should you need to support another language or integrate your services with Rollbar.

Quick and Advanced Search

The Rollbar dashboard offers quick searching options but, if that’s not enough, you can use the new Rollbar Query Language (RQL) — an SQL-like syntax for running queries on your Rollbar data.

JavaScript Source Maps

Errors are reported from your production systems, which may (or should) be hosting minified versions of your client-side JavaScript files. Minification can rename function names and renumber lines. Rollbar allows you to upload associated JavaScript source maps which ensures messages are identified with the original, uncompressed source code.

Cost Effective

Rollbar is free for personal projects and prototypes. Pricing is based on the number of events raised per monthregardless of team size. Adding another collaborator costs nothing.

The average Rollbar team has 30 developers but the system can scale to projects of unlimited sizes.

Team Time Saving

The biggest benefit: Rollbar saves considerable time. Team members have a central location which collates all reported errors and distributes tasks to whichever messaging and bug-tracking system they prefer.

Sign-up for Rollbar today — there’s a fully-featured, no-obligation 14-day trial period which requires no credit card or initial payment. You’ll soon wonder how you developed without Rollbar.

  • OlegM

    This is kind of neat thanks for sharing Craig

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

Get the latest in Front-end, once a week, for free.