Create a Sentry module in <jboss-path>/modules/io/sentry/main/module.xml:
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="io.sentry">
<resources>
<resource-root path="sentry-4.3.0.jar"/>
<resource-root path="sentry-jul-4.3.0.jar"/>
<resource-root path="gson-2.8.6.jar"/>
<resource-root path="slf4j-api-1.7.30.jar"/>
<resource-root path="."/>
</resources>
</module>Download listed above resources jar files to <jboss-path>/modules/io/sentry/main/:
Configure a SentryHandler in <jboss-path>/standalone/configuration/standalone.xml or <jboss-path>/domain/configuration/domain.xml file:
<subsystem xmlns="urn:jboss:domain:logging:8.0">
// Configure `SentryHandler`
<custom-handler name="SENTRY" class="io.sentry.jul.SentryHandler" module="io.sentry">
<level name="INFO"/>
</custom-handler>
<root-logger>
// ...
<handlers>
// include SENTRY handler in <root-logger>
<handler name="SENTRY"/>
<handler name="CONSOLE"/>
</handlers>
</root-logger>
...
</subsystem>Sentry reads the DSN from the system property sentry.dsn, environment variable SENTRY_DSN or the dsn property in <jboss-path>/modules/io/sentry/main/sentry.properties file. See the configuration page for more details on external configuration.
dsn=___PUBLIC_DSN___Two log levels are used to configure this integration:
- Configure the lowest level required for a log message to become an event (
minimumEventLevel) sent to Sentry. - Configure the lowest level a message has to be to become a breadcrumb (
minimumBreadcrumbLevel).
Breadcrumbs are kept in memory (by default the last 100 records) and are sent with events. For example, by default, if you log 100 entries with logger.config or logger.warn, no event is sent to Sentry. If you then log with logger.error, an event is sent to Sentry which includes those 100 config or warning messages. For this to work, SentryHandler needs to receive all log entries to decide what to keep as breadcrumb or send as event. Set the SentryHandler log level configuration to a value lower than what is set for the minimumBreadcrumbLevel and minimumEventLevel so that SentryHandler receives these log messages.
<subsystem xmlns="urn:jboss:domain:logging:8.0">
// ...
<custom-handler name="SENTRY" class="io.sentry.jul.SentryHandler" module="io.sentry">
// ...
<properties>
<properties name="minimumEventLevel" value="INFO"/>
<properties name="minimumBreadcrumbLevel" value="CONFIG"/>
</properties>
</custom-handler>
// ...
</subsystem>By default, MessageFormat#format method is used to render parameterized log messages. It can be changed to use String#format by setting printfStyle property to true:
<subsystem xmlns="urn:jboss:domain:logging:8.0">
// ...
<custom-handler name="SENTRY" class="io.sentry.jul.SentryHandler" module="io.sentry">
// ...
<properties>
<properties name="printfStyle" value="true"/>
<properties name="minimumBreadcrumbLevel" value="CONFIG"/>
</properties>
</custom-handler>
// ...
</subsystem>