DEV Community


Posted on

Monitor application errors with Sentry

How do you handle your application errors/exceptions❓

This is a question I often ask my colleagues. Surprisingly, but half of them answer that they have no dedicated procedure for such situations. That means that until customers contact the support and report the problem, they will be unaware of any issues. No need to mention that from a business perspective that might lead to customer loss.

Ask yourself this question and if you find that you fall into the same category, you might consider taking some actions

Sentry to the rescue❕

Marvel's Sentry

Sentry is a tool that takes application crashes and exceptions as first-class citizens, allowing you to manage the full crash lifecycle: from its occurrence till releasing a new version with the fix applied.

Sentry developers follow open-source philosophy, so you can run an instance on your premise. This option might come in handy if your application is highly secured or not allowed to access anything outside the private network. To simplify the deployment of Sentry, you can utilize the Docker image.

On the other hand, you might purchase a license and put off your shoulders the burden of supporting infrastructure.


Sentry claims to support 88 platforms. Here is how you can integrate Sentry into a Java application.

Your first step will be to register a new application on Sentry and obtain Data Source Name (DSN), which effectively the only required configuration property.

Manual integration

Although this integration option will require manual configuration as well as manual error push, you get full control of the process. With this option, it's up to you what data you would like to see in the error details on Sentry.

try {
} catch (Exception e) {
Enter fullscreen mode Exit fullscreen mode

Logger integration

If you use Log4j2 or Logback logger, you have an option to integrate it into the logger configuration. Just describe the appender for error level and all error log events will be posted to Sentry


    <appender name="Sentry" class="io.sentry.logback.SentryAppender">

    <root level="ERROR">
        <appender-ref ref="Sentry" />
Enter fullscreen mode Exit fullscreen mode

Sprin Boot integration

Like many other modules pluggable into Spring, Sentry provides its own starter bundle, named sentry-spring-boot-starter. After including defining sentry.dsn property value, you are ready to post error data with Sentry.captureException(e)


Although to my eye Sentry interface looks a bit overloaded with features, it starts growing on you over time. After several days of usage, you will grasp its essential features.
Alt Text


Sentry is a great tool for monitor errors on any application stage. If this brief overview caught your interest, make sure to check out the official blog for a lot more details.

Top comments (0)