Duplicate structured logs when running Azure Functions with Aspire #15992
Unanswered
hz-git-oss
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When running Azure Functions (.NET isolated) via .NET Aspire, we configure logging to export both:
Console logs (for Aspire dashboard )
Structured logs (via OpenTelemetry )
However, we are observing that each structured log appears twice, with identical content.
After tracing the behavior and reviewing documentation, it seems that Azure Functions host captures console output and forwards it into the telemetry pipeline, which causes duplication when the application itself already emits structured logs.
Observed behavior
One log is emitted directly via the structured logging pipeline.
A second identical structured log is emitted, originating from:
Host.Function.Console
This results in duplicate structured logs being exported.
Expected behavior
Console logs should:
Appear in the Aspire console output
Structured logs should:
Be exported only once via the structured logging pipeline
Question
Is there a supported or recommended way to avoid structured log duplication in this scenario?
Specifically, is there a way to:
Prevent the Function host from exporting console logs into the telemetry pipeline?
Or configure Aspire / Azure Functions so that:
Console logs are only used for console display
Structured logs remain single and authoritative
Any guidance, configuration, or best practice would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions