Error monitoring in Spring Boot application using Sentry
When building products, the hard thing is finding the bugs in your application after moving to production. When your users are using the application and found that server issue, How do you get to know about that problem so you can fix the problem before users start to complain about the application?
There are many services that offer this solution and one of them is Sentry. Sentry is a platform that can be integrated with your apps very easily and will give you all the insights about the exceptions that your application is generating.
You can start using sentry by simply signing up to the platform https://sentry.io/ and creating a new application. after creating your application, Sentry will give you the app id which is DSN (Data source name).
In order to integrate sentry in your spring boot, all you need to do is add its dependency in your pom.xml and add some properties in your application.yml file
Add the following dependency in your pom.xml
then add your sentry DSN in your application property file
To test the integration. just throw a new exception from your application.
throw new Exception("This is a test.");
and you should be able to see the exception captured in the sentry dashboard.
Another thing I like about sentry is, How easy it give all the insights on the dashboard and integration to another platform like Slack, Squadcast so that your team can be notified about the issue right away.
I have been using sentry in all of my personal projects as it is free to use for personal use.
Hope you like this article.