Most AI projects fail. Yours doesn’t have to.
Reserve your spot today and get a production-ready Agent Blueprint in just 3 weeks
6
spots‍
‍available
Register for Your Agent Blueprint
About
Capabilities
Custom AgentsReliable RAGCustom Software DevelopmentEval Driven DevelopmentObservability
LangChainCase StudiesFocused Lab
Contact us
Back
Blog

Sentry with Spring Boot

Setting up Sentry in a Spring Boot project is mostly straightforward, but there are a few gotchas. Here's what we ended up with and the caveats to watch out for, including duplicate errors and boot-time warnings.

Jul 7, 2020

By
Focused Team
Share:
Chicago downtown street view with tall skyscrapers and a bus passing through

After writing this article I've revised my approach. See this follow up article for details. The approach below still works, with some caveats.

 

 

We are trying out Sentry for error alerting at Focused Labs, and I wanted to set it up in my Spring Boot backend. For the most part, Sentry has been super easy to add to a project, but I hit a few little snags with the Spring Boot integration that I wanted to share with the community.

I'll keep this short, this is what I ended up with:

build.gradle.kts:

In some scenarios, this may lead to duplicate errors. The official docs warn against including both sentry-spring (which is pulled in by sentry-spring-boot-starter) and sentry-logback. Which makes sense since the Spring integration with Sentry is handling exceptions and sending them to Sentry and the Logback integration is watching logs, and then sending them to Sentry.

We are using GraphQL in our backend, so the sentry-spring behavior wasn't catching our exceptions since they are exclusively catching errors in the context of an MVC controller. Still, potentially, an exception would both be logged and caught by the Sentry exception handler, resulting in a duplicate error. If this becomes an issue, I'll have to revisit my dependencies.

This is why I am bothering with sentry-spring-boot-starter

application.yaml:

Sweet sweet YAML.

Thanks to the configuration support in sentry-spring-boot-starter I can just locate my Sentry configuration right next to the rest of my Spring Boot configuration.

logback-spring.xml:

By using include here, I am able to defer to the default Spring Boot log configuration and only override what I absolutely need to. In this case, adding an additional appender to the root logger.

And that's it! It looks straight forward when laid out here, but took a few iterations to get everything working. Hopefully, this helps other people out with the same process.

Your message has been sent!

We’ll be in touch soon. In the mean time check out our case studies.

See all projects
/Contact Us

Let's Build better Agents Together

Modernize your legacy with Focused

Get in touch
Focused

433 W Van Buren St Suite 1100-C
Chicago, IL 60607
‍work@focused.io
‍
(708) 303-8088

‍

About
Leadership
Capabilities
Case Studies
Focused Lab
Careers
Contact
© 2026 Focused. All rights reserved.
Privacy Policy