We have a spring 1.5.17 app and are trying to simply integrate Sentry. Because this is an older version of Spring (no, upgrading isn t a possibility), we re following Sentry s Legacy SDK 1.7
directions here. It s quite straightforward.
Configuration
页: 1 我们使用其他春天图书馆,如伐木/开工/jpa,但并未表现出清晰度。 所有相同的春季版本。
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.17.RELEASE</version>
</dependency>
Additionally, added sentry.properties
file under src/main/resources
.
enabled=true
dsn=***
environment=uat
sample.rate=1.0
stacktrace.app.packages=com.pls
stacktrace.hidecommon=false
Application
创建了一个碎块组合文件,记录每张entry子上写两具。
@Configuration
public class SentryConfig {
@Bean
public HandlerExceptionResolver sentryExceptionResolver() {
return new io.sentry.spring.SentryExceptionResolver();
}
@Bean
public ServletContextInitializer sentryServletContextInitializer() {
return new io.sentry.spring.SentryServletContextInitializer();
}
}
Via breakpoints, I ve confirmed that these beans are initializing and they are getting the properties from sentry.properties
correctly. A related thread, I found that if I manually make SentryClient.captureEvent(event)
calls, then events show up in sentry. This means that the sentry client is setup correctly and working, but spring isn t actually ever calling .captureEvent()
.
为了证实我的怀疑,我进入了SenterExceptionResolver bean,并确认该法典从未打过这一突破点。
I ve试图通过在@RestController
上投掷 du错误而触发点。
@GET
@Path("/test")
public Object throwError(){
LOGGER.error("ERROR BEING LOGGED");
throw new RuntimeException("ERROR THROWN");
}
While this error is certainly thrown in the console logs, it does NOT trigger the .capture()
codepath.
Logging?
, 相关<提到了一些带有伐木模块的内容,但我不理解这种关联。
不管怎样,我尝试增加各种伐木附属物(例如:www.logback assection in this senter doc)。 我的组合可能没有什么东西!
如果是这样的话,我们确实使用开端log-博客......
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
请注意,当我添加<条码> 填入-logback 依附时,该装货箱就装了。