This guide explains sentry logging and how to configure it.

Run Time Configuration

Run time configuration of logging is done through the normal application.properties file.

Configuration property fixed at build time - ️ Configuration property overridable at runtime

Configuration property

Type

Default

Determine whether to enable the Sentry logging extension.

boolean

false

Sentry DSN The DSN is the first and most important thing to configure because it tells the SDK where to send events. You can find your project’s DSN in the “Client Keys” section of your “Project Settings” in Sentry.

string

required

The sentry log level.

Level

WARN

Sentry differentiates stack frames that are directly related to your application (“in application”) from stack frames that come from other packages such as the standard library, frameworks, or other dependencies. The difference is visible in the Sentry web interface where only the “in application” frames are displayed by default. You can configure which package prefixes your application uses with this option. This option is highly recommended as it affects stacktrace grouping and display on Sentry. See documentation: https://quarkus.io/guides/logging-sentry#in-app-packages

list of string

Description

Sentry is a really easy way to be notified of errors happening on you Quarkus application.

It is a Open Source, Self-hosted and cloud-based error monitoring that helps software teams discover, triage, and prioritize errors in real-time.

They offer a free starter price for cloud-based or you can self host it for free.

Configuration

To start of, you need to get a Sentry DSN either by creating a Sentry account or installing your self-hosted Sentry.

In order to configure Sentry logging, the quarkus-logging-sentry extension should be employed. Add this extension to your application POM as the following snippet illustrates.

Modifications to POM file to add the Sentry logging extension
<build>
  <dependencies>
    <!-- ... your other dependencies are here ... -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-logging-sentry</artifactId>
    </dependency>
  </dependencies>
</build>

“In Application” Stack Frames

Sentry differentiates stack frames that are directly related to your application (“in application”) from stack frames that come from other packages such as the standard library, frameworks, or other dependencies. The difference is visible in the Sentry web interface where only the “in application” frames are displayed by default.

You can configure which package prefixes your application uses with the stacktrace.app.packages option, which takes a comma separated list.

quarkus.log.sentry.in-app-packages=com.mycompany,com.other.name

If you don’t want to use this feature but want to disable the warning, simply set it to "*":

quarkus.log.sentry.in-app-packages=*

Example

All errors and warnings occuring in any the packages will be sent to Sentry with DSN https://abcd@sentry.io/1234
`
quarkus.log.sentry=true
quarkus.log.sentry.dsn=https://abcd@sentry.io/1234
quarkus.log.sentry.in-app-packages=*
----
All errors occuring in the package org.example will be sent to Sentry with DSN https://abcd@sentry.io/1234
quarkus.log.sentry=true
quarkus.log.sentry.dsn=https://abcd@sentry.io/1234
quarkus.log.sentry.level=ERROR
quarkus.log.sentry.in-app-packages=org.example