Sentry vs Logging

Two halves make one whole

Isn't Sentry just logging?

Often we get asked what the difference is between Sentry and traditional logging. It makes a lot of sense when you're looking at something like a web application, where your errors typically go to a logfile on disk. When you start looking at mobile or desktop applications things start to become a bit more clear.

The best way to think about things is this: logging provides you with a trail of events. Often those events are errors, but many times they're simply informational. Sentry is fundamentally different because we focus on exceptions, or in other words, we capture application crashes.

To summarize, Sentry works with your application logging infrastructure, often integrating directly. It does not replace the need for those logs, and it's also not a destination for things that aren't actionable errors or crashes.

Beyond Errors

While Sentry is primarily used for reporting application exceptions, there's often cases where you want to capture other issues with your code. For example, you might be capturing deprecation warnings in Python. Code that looks something like this:

logging.warn('The Example.hello() method has been deprecated. Use Example.goodbye() instead.')

This is something that you could easily capture in a validation phase (e.g. using continuous integration), but it's also something you might want to know about in production. Sentry aims to cater to these kinds of issues as well, but there's going to be various limitations and caveats. As with errors, you'd still want to ensure you're logging these with your general logging infrastructure.

You'll need to determine what's right for you, but the important thing to remember is Sentry aims to support a lot, but it's primarily for capturing errors.

Events in Sentry

The most important difference between your general logging infrastructure and Sentry is how events are stored. Logging is very much intended to capture the entirety of your data, and give you maximum auditability. Systems like Sentry lose a lot of data when computing rollups and transformations. For example, Sentry won't store the full details of every error that comes in if it's one that already exists. This effectively means that Sentry doesn't make guarantees of allowing you to find an exact historical error. Because of this, it's important that in cases where you do need to be able to trace events you maintain them in your existing logging infrastructure.

Another important differentiator between Sentry and generic logging is the amount of context captured. This context is extremely valuable when debugging an issue, but matters a lot less in many situations where you'd use traditional logging. This is important because of the large cost associated with storing that context. It's simply something that you generally wouldn't want to pay for for all logging, but is absolutely critical for crash analysis.

Good Citizens

It's important to us here at Sentry that we play well with other tools in the ecosystem. Tools like New Relic and Elastic's ELK stack often overlap in functionality, but they serve different purposes. As engineers, we find ourselves thinking we can duct tape things together, but it's important to remind ourselves of the difficulty of using a square peg in a round hole. Crash reporting is a term that is often unfamiliar in the web industry, but once you step back and look at the greater scope of application monitoring it quickly becomes clear how things fit together.

© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.