→ Nederlandstalig? E: kevin@roam.beT: +32475435169

Tracking errors in Java apps with Sentry

There are plenty of options when monitoring Java applications, but monitoring errors gets a whole lot easier using Sentry.

Keeping track of errors in Java applications is easy. Keeping track of those errors on remote systems is a bit harder, but you've still got plenty of options to choose from. One of those options is to track the log files with something like Nagios. Another option is to simply adapt the logging configuration to send emails when an error occurs, which quickly results in people filtering those emails from their inbox and not being notified of serious problems. Enter Sentry and Raven-Java, the Sentry client for Java.

Sentry

Sentry screenshot

The use case for Sentry is stated explicitly on the website:

Track exceptions as they happen and diagnose them without user assistance.

That's it, really. But that's a powerful tool to have! You don't even have to use the hosted Sentry available at getsentry.com, because Sentry is an open source application, based on Django with full documentation on how to set it up. Missing something? Add a plugin. Can't find a client for your language? Write one.

Raven-Java

If you're using Log4j, you're in luck: Raven-Java comes with a Log4j appender that will pass errors along to the configured Sentry instance. If you prefer another logging framework or you just want to use the Raven client yourself, no problem. If you head over to the refactoring branch of Raven-Java you'll notice the client can be used standalone, without any log4j dependencies, so you can easily roll your own appender or whatever else you want to do.

So take Sentry and Raven-Java for a spin:

Are you a Java developer getting started with Django? Then you'll surely love my upcoming Django for Java Developers ebook! Find out how to manage dependencies, start, build and deploy a Django project from the perspective of a Java web developer.

§