<commit_before>////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc
////
= Quarkus - Configuring Sentry Logging

include::./attributes.adoc[]

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.

include::{generated-dir}/config/quarkus-logging-sentry.adoc[opts=optional, leveloffset=+1]

== Description


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

It is a 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.

WARNING: Sentry's Java SDK is open source, but recently sentry.io https://blog.sentry.io/2019/11/06/relicensing-sentry[changed the license] for their backend to the non-open source BSL license. This might or might not be an issue for your project and product.

== Configuration

To start of, you need to get a Sentry DSN either by https://sentry.io/signup/[creating a Sentry account] or https://docs.sentry.io/server/[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
[source,xml]
----
<build>
  <dependencies>
    <!-- ... your other dependencies are here ... -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-logging-sentry</artifactId>
    </dependency>
  </dependencies>
</build>
----

[id="in-app-packages"]
=== “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.
[source, properties]
----
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 "*":

[source, properties]
----
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`
[source, properties]
`
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`
[source, properties]
----
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
----

NOTE: Sentry has recently https://blog.sentry.io/2019/11/06/relicensing-sentry[re-licensed most of its code to BSL] - which is not an OSI-approved license. The Java SDK is still under the 3-Clause BSD license.
<commit_msg>Only have one warning about the non-open source Sentry license<commit_after>////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc
////
= Quarkus - Configuring Sentry Logging

include::./attributes.adoc[]

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.

include::{generated-dir}/config/quarkus-logging-sentry.adoc[opts=optional, leveloffset=+1]

== Description


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

It is a 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.

WARNING: Sentry's Java SDK is open source, but recently sentry.io https://blog.sentry.io/2019/11/06/relicensing-sentry[changed the license] for their backend to the non-open source https://github.com/getsentry/sentry/blob/master/LICENSE[BSL license]. This might or might not be an issue for your project and product.

== Configuration

To start of, you need to get a Sentry DSN either by https://sentry.io/signup/[creating a Sentry account] or https://docs.sentry.io/server/[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
[source,xml]
----
<build>
  <dependencies>
    <!-- ... your other dependencies are here ... -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-logging-sentry</artifactId>
    </dependency>
  </dependencies>
</build>
----

[id="in-app-packages"]
=== “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.
[source, properties]
----
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 "*":

[source, properties]
----
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`
[source, properties]
`
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`
[source, properties]
----
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
----


{'fraction_non_alphanumeric': 0.10182416267942583, 'fraction_numerical': 0.008821770334928229, 'mean_word_length': 4.2339593114241, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6122384', 'n_tokens_mistral': 2015, 'n_tokens_neox': 1897, 'n_words': 732}