Vishnu G S
Vishnu G S

Reputation: 714

JBoss JUL Sentry integration

While integrating sentry with JUL in JBoss, I got an error saying:

The configuration file in 'logging.properties' appears to be a J.U.L. configuration file. The log manager does not allow this type of configuration file. I followed the steps suggested in https://github.com/getsentry/raven-java/tree/master/raven

What might be the cause of this problem? My work is reflected in https://github.com/gsvishnugs/wildfly-jul-raven

Upvotes: 3

Views: 1018

Answers (2)

Vishnu G S
Vishnu G S

Reputation: 714

Use the following jboss-cli commands to kickstart sentry connection:

add new module

module add --name=com.getsentry.raven --resources=/path/to/jars/raven-7.6.0.jar,/path/to/jars/jackson-core-2.7.3.jar,/path/to/jars/slf4j-api-1.7.21.jar,/path/to/jars/slf4j-jdk14-1.7.9.jar --resource-delimiter=, --dependencies=javax.api    

       

add custom-handler

/subsystem=logging/custom-handler=sentry:add(name=sentry,class=com.getsentry.raven.jul.SentryHandler,module=com.getsentry.raven,enabled=true,formatter=PATTERN,level=WARN,properties=[("dsn" => "https://pub_key:[email protected]/app_id")])

Adding to Root Logger

/subsystem=logging/root-logger=ROOT:add-handler(name=sentry)

Be advised to download the dependent jar mentioned in above new module command.

Upvotes: 2

James R. Perkins
James R. Perkins

Reputation: 17780

While the JBoss Log Manager used in WildFly does extend JUL it does not use a JUL configuration file. You need to use a different properties for JBoss Log Manager. While not an official doc I do have a gist that explains the format required.

You're file would need to look something like this.

logger.handlers=SENTRY_HANDLER
logger.level=WARN

handler.SENTRY_HANDLER=com.getsentry.raven.jul.SentryHandler
handler.SENTRY_HANDLER.properties=dsn,tags
handler.SENTRY_HANDLER.tags=tag1\:value1,tag2\:value2
handler.SENTRY_HANDLER.dsn=https\://test\:[email protected]/test

Do note by setting the logger.level=WARN you'll only see warning messages from your application. Also by using a logging.properties file you won't see any messages in the server.log or on the console.

Upvotes: 0

Related Questions