Azure / Azure/azure-functions-dotnet-worker

UseFunctionsWorkerDefaults() prevents worker logs from appearing in console/log stream while logs are still exported to Application Insights

Open
#3,487 0 comments 0 reactions 0 assignees View on GitHub
Needs: Triage (Functions) potential-bug
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

### Description

When using `UseFunctionsWorkerDefaults()`, worker logs generated through `ILogger` are visible in Application Insights and correctly correlated as part of the end-to-end request trace. However, the same logs are no longer emitted to stdout and therefore do not appear in either:
 
- Local console output (`func start`)
- Azure Container Apps Log Stream
 
When `UseFunctionsWorkerDefaults()` is removed, worker logs are emitted to stdout and become visible in both the local console and ACA Log Stream. However, the telemetry behavior changes, and the log is no longer attached to the end-to-end trace in Application Insights.
 
I would expect `UseFunctionsWorkerDefaults()` to preserve stdout logging behavior while also enabling the additional OpenTelemetry correlation functionality.

### Steps to reproduce

#### Environment
 
- .NET 10
- Azure Functions Isolated Worker
- Microsoft.Azure.Functions.Worker.OpenTelemetry 1.2.0
- OpenTelemetry-based configuration
- Azure Monitor exporter

#### Host.json

{
"version": "2.0",
"telemetryMode": "OpenTelemetry",
"logging": {
"fileLoggingMode": "debugOnly",
"logLevel": {
"default": "Warning",
"Microsoft": "Warning"
}
}
}

#### Startup configuration

IHostBuilder.ConfigureServices(services =>
services.AddOpenTelemetry()
...
.UseFunctionsWorkerDefaults()
.UseAzureMonitor();
 
IHostBuilder.ConfigureLogging(logging =>
{
logging.AddConsole();
 
logging.AddOpenTelemetry(options =>
{
options.IncludeFormattedMessage = true;
options.IncludeScopes = true;
});
});

#### **When: _logger.LogError(...)**

Observed:
Application Insights within e2e event trace:
✅ Log visible
 
Console / ACA Log Stream:
❌ Log missing

Remove
.UseFunctionsWorkerDefaults()

Observed:
Application Insights:
⚠️ Different telemetry behavior, I have the failed request but with no LogError as part of the e2e event trace
 
Console / ACA Log Stream:
✅ Log visible

#### Question

Is it expected that UseFunctionsWorkerDefaults() suppresses worker log output to stdout/log streams, or is this a bug/regression in the Azure Functions OpenTelemetry integration?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported startup configuration, especially UseFunctionsWorkerDefaults(), AddConsole(), and AddOpenTelemetry(), and trace how worker logs reach stdout versus Application Insights. Reproduce the behavior with the stated .NET 10 and Azure Functions isolated worker setup; done means logs remain visible in local and ACA streams while retaining end-to-end telemetry correlation.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.