APM agent breaks log.error when using StructuredLogEncoder with ecs format
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- java, spring-boot
調査の方向性
まず、ecs 用に設定された logback-spring.xml の StructuredLogEncoder と、Logger#error(String, Throwable) の呼び出しを使って問題を再現します。レポートで説明されている APM agent、StructuredLogEncoder、error フィールド間の相互作用を調べます。ロギングによって appender の例外なしに整形式の JSON が生成されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 593
- フォーク
- 337
- 平均マージ
- 15時間 24分
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
elastic/apm-agent-java のほかの issue
-
agent-java
難易度 2/5 1〜2日 初心者へのやさしさ 62/100
elastic/apm-agent-java#2844 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Improve docs and add error log related to illegal activation of transaction対応中かも @AzazelSensei が 33 日前に担当しました。 オープンdocs good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
elastic/apm-agent-java#850 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Custom HttpURLConnection throwing unchecked exception can stall the agent対応中かも @jackshirazi が 5 日前に担当しました。 オープンagent-java bug
elastic/apm-agent-java#4590 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
agent-java community triage
elastic/apm-agent-java#4573 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-java
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
elastic/apm-agent-java#4549 ·
メンテナーはふだん 1 日以内に返信
elastic/apm-agent-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/java-sdk#1174 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
module: core
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
bigbluebutton/bigbluebutton#26028 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MetricsHub/metricshub-community#1390 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/rocketmq-dashboard#6331 ·
メンテナーはふだん 5 日以内に返信
-
status: team-only type: dependency-upgrade
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
spring-projects/spring-boot#52143 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信