Azure Functions Java: Duplicate log entries in Portal Log Stream since agent 3.7.0
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- azure, java
调研方向
检查 PR #3962 中 agent 3.7.0 的依赖项变更,并比较 OpenTelemetry Instrumentation 2.9.0 与 2.10.0,重点关注 JUL 处理和 Portal Log Stream 路径。使用 APPLICATIONINSIGHTS_ENABLE_AGENT=true 和 context.getLogger().info() 进行复现,然后将行为与 agent 3.6.2 进行比较。完成标准是:日志在 App Insights traces 中只出现一次,且 Portal Log Stream 中没有 [undefined] 重复项。
由索引模型根据 Issue 内容生成。
描述
Description
When APPLICATIONINSIGHTS_ENABLE_AGENT=true (the default), calls to context.getLogger().info() produce duplicate entries in the Azure Portal Log Stream:
[Information]from the host RPC log pipeline[undefined]from the AI agent's JUL auto-instrumentation
The duplication only appears in the Portal Log Stream. In the App Insights traces table, the user log message appears once (from the agent only). The entries stored in App Insights are identical in structure between the working and broken agent versions.
Regression
Introduced in agent 3.7.0, which upgraded OpenTelemetry Java Instrumentation from 2.9.0 to 2.10.0 (PR #3962). No AI agent code changes were made between 3.6.2 and 3.7.0 regarding JUL handling. The behavioral change comes from the upstream OTel dependency bump.
With 3.6.2, the agent captures JUL logs and sends them to App Insights without producing a duplicate in the log stream. Starting with 3.7.0, the same capture also produces an [undefined] entry in the log stream.
| Agent | OTel Instrumentation | User log in AI traces | Duplicate in Log Stream |
|---|---|---|---|
| 3.6.2 | 2.9.0 | Yes | No |
| 3.7.0+ | 2.10.0+ | Yes | Yes |
Affects all Java versions (8, 11, 17, 21, 25) on Linux Dedicated.
Workarounds
| Workaround | Tradeoff |
|---|---|
APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_ENABLED=false |
Eliminates duplication but user logs from context.getLogger() no longer appear in App Insights traces |
APPLICATIONINSIGHTS_ENABLE_AGENT=false |
Eliminates duplication but disables all AI agent functionality |
Downgrade to agent 3.6.2 via languageWorkers__java__arguments |
Not viable for managed identity users (azure-functions-java-worker#820) |
No workaround fully restores the 3.6.2 behavior (user logs in AI traces without log stream duplication).
Expected behavior
The agent should capture JUL logs for App Insights without producing a duplicate [undefined] entry in the log stream, as it did in 3.6.2.
- 主要语言
- Java
- 星标
- 327
- 派生
- 222
- 平均合并
- 22 小时 34 分钟
- 30 天内合并 PR
- 14
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/ApplicationInsights-Java 的其他 Issue
-
microsoft/ApplicationInsights-Java#4851 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 45/100
microsoft/ApplicationInsights-Java#4817 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 42/100
microsoft/ApplicationInsights-Java#4770 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 30/100
microsoft/ApplicationInsights-Java#4769 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
microsoft/ApplicationInsights-Java#4729 · 121 条评论 ·
查看 microsoft/ApplicationInsights-Java 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 65/100
inu-appcenter/memorIN-backend#288 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
frontend maui-pilot pilot-ask question
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
area/plugin
难度 2/5 1-3 小时 新手友好度 75/100
kestra-io/plugin-kestra#190 ·