Integration
sentry-spring-boot-jakarta
Java Version
21
Version
8.16.0
Steps to Reproduce
- Spring Boot 3.5.3
- no logback.xml
- sentry.dsn in applicaiton.yml
Dependencies on classpath:
- sentry
- sentry-logback
- sentry-reactor
- sentry-spring-boot-jakarta
- sentry-spring-boot-starter-jakarta
- sentry-spring-jakarta
Expected Result
No warnings about sentry failing to init
Actual Result
There is a warning logged:
12:17:28,447 |-WARN in io.sentry.logback.SentryAppender[SENTRY_APPENDER] - Failed to init Sentry during appender initialization: DSN is required. Use empty string or set enabled to false in SentryOptions to disable SDK.
Even tho it works.
Adding a breakpoint in Sentry.init() reveals, that is been called twice, once from SentryAutoConfiguration and again from SentryAppender#start via SentryLogbackInitializer. The problem on that second call is, that the SentryAppender creates an empty SentryOptions instance that is used in start(). If the SentryLogbackInitializer would pass its instance of SentryProperties to the Appender on creation, the warning does not appear.
Potential fixes (from my understanding of what happens :D):
- Add
sentryAppender.setOptions(sentryProperties); here and potentially here too
- or verify if the condition here should possibly be changed to
options.getDsn() != null
Integration
sentry-spring-boot-jakarta
Java Version
21
Version
8.16.0
Steps to Reproduce
Dependencies on classpath:
Expected Result
No warnings about sentry failing to init
Actual Result
There is a warning logged:
Even tho it works.
Adding a breakpoint in
Sentry.init()reveals, that is been called twice, once fromSentryAutoConfigurationand again fromSentryAppender#startviaSentryLogbackInitializer. The problem on that second call is, that theSentryAppendercreates an emptySentryOptionsinstance that is used instart(). If theSentryLogbackInitializerwould pass its instance ofSentryPropertiesto the Appender on creation, the warning does not appear.Potential fixes (from my understanding of what happens :D):
sentryAppender.setOptions(sentryProperties);here and potentially here toooptions.getDsn() != null