You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing an Azure Function app with C#/.NET9 in the isolated worker model.
According to the docs, it should be possible to send application logs directly to Application Insights instead of relaying them through the Function host.
In appsettings.json, I have the following logging configuration:
to capture all logs in the AssetGovernance* category with "Debug" level or higher.
In Program.cs, I configure Application Insights to send application logs directly to Application Insights:
// Configure application
builder.ConfigureFunctionsWebApplication();
// Configure services
builder.Services.AddApplicationInsightsTelemetryWorkerService();
builder.Services.ConfigureFunctionsApplicationInsights();
builder.Services.Configure<WorkerOptions>(options => { });
...
// Configure logging
builder.Logging.Services.Configure<LoggerFilterOptions>(options =>
{
var defaultRule = options.Rules.FirstOrDefault(rule => rule.ProviderName == "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
if (defaultRule is not null)
{
options.Rules.Remove(defaultRule);
}
});
Now, the problem is that no "Debug" logs are send to Application Insights, unless I also set logging.logLevel.Function: "Debug" in host.json, which means that logs are actually relayed through the Function host?
How can I send logs directly to Application Insights, so logging filtering is only governed by appsettings.json (i.e., host.json has no effect)?
Steps to reproduce
See above
The text was updated successfully, but these errors were encountered:
Version
v4.0.6610
Description
I'm developing an Azure Function app with C#/.NET9 in the isolated worker model.
According to the docs, it should be possible to send application logs directly to Application Insights instead of relaying them through the Function host.
In
appsettings.json
, I have the following logging configuration:to capture all logs in the
AssetGovernance*
category with "Debug" level or higher.In
Program.cs
, I configure Application Insights to send application logs directly to Application Insights:Now, the problem is that no "Debug" logs are send to Application Insights, unless I also set
logging.logLevel.Function: "Debug"
inhost.json
, which means that logs are actually relayed through the Function host?How can I send logs directly to Application Insights, so logging filtering is only governed by
appsettings.json
(i.e.,host.json
has no effect)?Steps to reproduce
See above
The text was updated successfully, but these errors were encountered: