getsentry / getsentry/sentry-java

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

Open
#5,445 5 comments 5 reactions 1 assignee Claimed by @adinauer View on GitHub
Feature Java Logs Platform: Java
Dominant language
Kotlin
Stars
1.4k
Forks
478
Avg merge
2d 23h
Merged PRs (30d)
67

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.