APM agent breaks log.error when using StructuredLogEncoder with ecs format
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- java, spring-boot
- Ambito
- backend, observability-sre
Direzione di ricerca
Inizia riproducendo il problema con lo StructuredLogEncoder di logback-spring.xml configurato per ecs e una chiamata a Logger#error(String, Throwable). Esamina l’interazione tra l’APM agent, StructuredLogEncoder e il campo error descritta nel report. Il lavoro è completo quando il logging produce JSON ben formato senza un’eccezione dell’appender.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
We are using the version 1.55.5 with experimental Spring Boot 4 support. Since the update we have problems with log.error in SLF4J. This is the logback-spring.xml configuration:
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="org.springframework.boot.logging.logback.StructuredLogEncoder">
<format>ecs</format>
</encoder>
</appender>
When using the apm agent we are seeing this in the logs instead of the real error log:
07:18:54,651 |-ERROR in ch.qos.logback.core.ConsoleAppender[CONSOLE] - Appender [CONSOLE] failed to append. java.lang.IllegalStateException: The name 'error' has already been written
According to my research, this happens if the JSON log already contains a field with the same name, in this case error. Logback uses the field error for a complex object that contains error.message and error.stack_trace. This is also documented in the Elastic Common Schema.
Steps to reproduce
Use the org.springframework.boot.logging.logback.StructuredLogEncoder with ecs format as described and call org.slf4j.Logger#error(java.lang.String, java.lang.Throwable).
Expected behavior
No exception during logging, but a well-formed JSON log containing the error.
- Lingua principale
- Java
- Stelle
- 593
- Fork
- 338
- Merge medio
- 1g 9h
- PR unite (30g)
- 13
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di elastic/apm-agent-java
-
agent-java community triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elastic/apm-agent-java#4594 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-java
Difficoltà 2/5 1-2 giorni Idoneità per principianti 62/100
elastic/apm-agent-java#2844 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Improve docs and add error log related to illegal activation of transactionForse già presa @AzazelSensei l’ha presa 37 giorni fa. Apertadocs good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
elastic/apm-agent-java#850 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
agent-java community triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
elastic/apm-agent-java#4593 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-java community triage
elastic/apm-agent-java#4573 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di elastic/apm-agent-java
Issue simili
-
approved bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
checkstyle/checkstyle#21981 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[lake/iceberg] Reserved write-mode properties can be set and reset through their `iceberg.` keyForse già presa @aphenix-r7 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
MCModderAnchor/TACZ#758 ·
-
area/plugin good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
kestra-io/plugin-soda#137 ·