getsentry / getsentry/sentry-java

Support slf4j/logback fluent logging and key-value pairs in logback logging integration

Abierto
#5,445 5 comentarios 5 reacciones 1 asignado Reclamado por @adinauer Ver en GitHub
Feature Java Logs Platform: Java
Lenguaje dominante
Kotlin
Estrellas
1.4k
Forks
478
Merge medio
2 d 23 h
PR fusionados (30 d)
67

Descripción

### Problem Statement

We are using SLF4J fluent logging API -- https://www.slf4j.org/manual.html#fluent in a Spring Boot application using logback as implementation.

We have enabled Sentry logback integration
```
...


true
CHANGE-IT

INFO
ERROR

...
```

Dependencies:
```
...
[INFO] +- io.sentry:sentry-spring-boot-starter-jakarta:jar:8.11.1:compile
[INFO] | \- io.sentry:sentry-spring-boot-jakarta:jar:8.11.1:compile
[INFO] | +- io.sentry:sentry-spring-jakarta:jar:8.11.1:compile
[INFO] | \- io.sentry:sentry-reactor:jar:8.11.1:compile
[INFO] +- io.sentry:sentry-logback:jar:8.11.1:compile
[INFO] | \- io.sentry:sentry:jar:8.11.1:compile
...
[INFO] +- org.springframework.boot:spring-boot-starter-logging:jar:3.4.4:compile
[INFO] | +- ch.qos.logback:logback-classic:jar:1.5.18:compile
[INFO] | \- org.apache.logging.log4j:log4j-to-slf4j:jar:2.24.3:compile
[INFO] | \- org.apache.logging.log4j:log4j-api:jar:2.24.3:compile
...
[INFO] +- org.slf4j:jul-to-slf4j:jar:2.0.17:compile
[INFO] +- ch.qos.logback:logback-core:jar:1.5.18:compile
...
[INFO] +- io.sentry:sentry-logback:jar:8.11.1:compile
[INFO] | \- io.sentry:sentry:jar:8.11.1:compile
...
```

Our log messages look like this:
```
log.atError()
.addKeyValue("key1", valueInstance1)
.addKeyValue("key2", valueInstance2)
.setMessage("Error doing blah blah blah")
.setCause(ex)
.log()
```
Our problem is that in Sentry dashboard we are not seeing the key-value'd information, and instead we are only seeing the "Error doing ..." message.

In our log file we are indeed seeing these values via `... [%kvp] ...` in the file log pattern set via our `logback-spring.xml`.

Please add support for this usage pattern in the Java SDK. If this is already supported and I missed it from the documentation, please point me towards it, thanks!

### Solution Brainstorm

_No response_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.