Skip to content

Azure Functions Java: Duplicate log entries in Portal Log Stream since agent 3.7.0 #4698

@ahmedmuhsin

Description

@ahmedmuhsin

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.

Image Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions