Search code examples
javaspringspring-bootloggingsentry

Sentry not working with lombok logging (with version 1.7.30 Sentry)


I am trying to set up sentry in my project with version 1.7.30. It is a spring boot project with gradle, i am using the sentry spring boot starter dependency with:

implementation group: 'io.sentry', name: 'sentry-spring-boot-starter', version: '1.7.30'
implementation group: 'io.sentry', name: 'sentry-logback', version: '1.7.30'

I have a company sentry dashboard for this version. I have set the DNS in application.properties. My application.properties look like this:

sentry.dsn=xxxxx

I am able to capture the exception with Sentry.capture(e) any where, but while using lombok, with @Slf4j annotation logging, with log.error(e) I am unable to capture exception and its not reflecting in my dashboard. I have tried it with version 4.3 and it was working in that. But once i came to version 1.7.30 i am only able to do it manually with Sentry.capture() function.


Solution

  • You're mixing configuration options from Sentry SDK 3.x+ with Sentry 1.7.x. Sentry + Logback auto-configuration and properties like sentry.logging.minimum-event-level works only in the new SDK.

    If you must use 1.7.x you have to configure Logback appender in logback.xml.

    https://docs.sentry.io/platforms/java/legacy/logback/