Debug Issues Faster with Breadcrumbs
If there’s one thing we’re particularly proud of Sentry for, it’s that not only
does it notify you of new issues in your applications, but that it gives you a
lot of helpful tools to help you quickly fix them – like augmented stack traces
with surrounding source code, or our HTTP replay tool, or built-in user crash
report dialogs (new), just to name a few.
Hot on the heels of our user feedback
announcement, we’re pleased to
reveal another really, super useful tool – breadcrumbs.
Breadcrumbs are a trail of events that occurred in your application leading
up to the primary error. They can be as simple as generic logging messages, or
they can contain rich metadata about the state of your application: network
requests, database queries, UI events, navigation changes, or even earlier
occurring errors.
Breadcrumbs can be incredibly helpful in reproducing the steps that led to the
error you’re debugging. We’ve been dogfooding them here at Sentry for some
time, and they add critical context to errors that a stack trace alone can’t
provide. Once you use them, you won’t go back.
Get Started using Breadcrumbs Today
We currently have breadcrumb support for three platforms – browser JavaScript error tracking, PHP error tracking, and Python error tracking – with more on the way.
Browser JavaScript
Upgrade to the latest version of Raven.js, 3.0:
$ npm install raven-js@3.0
Raven.js now automatically records a handful of useful breadcrumbs:
XMLHttpRequests
UI clicks and keypresses on DOM elements
URL changes (works with most routing libraries, e.g. react-router)
log statements via
console.log
Note that 3.0 introduces some potentially breaking changes. Please take a look at the CHANGELOG.
Python
The latest version of raven-python (5.14) automatically records the following:
DB queries in Django
HTTP requests (via
httplib
,urllib
orrequests
)log statements via
logging
$ pip install 'raven>=5.14'
Breadcrumbs will be automatically enabled and are implemented by patching
the logging system in Python as well as some libraries. This can be
disabled if you prefer.
PHP
The latest version of sentry-php (0.16.0) has support for capturing your own breadcrumbs, as well as a native Monolog handler to automatically capture logging events.
Additionally sentry-laravel (0.2.0) will automatically instrument Monolog for Laravel 5.x.
Other platforms
We’ll be slowly expanding support for breadcrumbs to our other official Sentry
clients over the coming months (e.g., Ruby error tracking, Node.js error tracking).
If you are running a custom Sentry client, you can check out our client API
documentation on breadcrumbs to see how to get begin recording breadcrumbs today.