Sentry’s New Java Agent: Adding Context to Your Stack Traces

Brett Hoerner /

We’re enhancing the existing Sentry Java SDK with our new Java agent. The thing is — it’s still in beta, and we need your feedback.

Once downloaded, the agent will enhance your application stack traces on Sentry by adding the names and values of local variables to each frame. Specifically, the agent provides much more detail about the current state of the application at the time of the error than you would usually have. In many cases, this additional information will help you avoid having to debug or recreate the issue manually.

Sentry's Java agent

Note that Java agents only work for JVM desktop and server applications, and not on Android.

Step one: set up our Java agent.

Make sure to download the latest agent from Github.

Now run your Java application with the -agentpath argument. Only exceptions that contain at least one frame from your application will be processed by the agent, so make sure you configure the stacktrace.app.packages option (read more on the configuration page).

For example:

java -agentpath:./libsentry_agent_linux-x86_64.so \
  -Dsentry.stacktrace.app.packages=io.sentry.example \
   -cp ./application.jar \
   io.sentry.example.Application

You will still need to install and configure the Sentry Java SDK.

With the SDK configured, the agent will automatically enhance your events where applicable.

Step two: tell us what you think.

We hope you find the new Java agent useful. Perhaps you’ll find it so useful that you want to share your experience and feedback with us. In fact, that would be great and very helpful. Please do that.

You can share any feedback or suggestions that you might have about the new Java agent here. Thanks in advance. We appreciate your help.