I am facing issue in moving my Function App code from in-process to isolated process. Here is my application insight code which I am using in my startup.cs
. I am not using APPINSIGHTS_INSTRUMENTATIONKEY
configuration.
class Startup : FunctionsStartup
{
public override void
ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder)
{
builder.ConfigurationBuilder
.AddApplicationInsightsSettings(applicationInsightsInstrumentationConnectionstring);
}
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddApplicationInsightsTelemetry();
}
}
Now I want to move it to program.cs
for Function App isolated process. I have tried different ways but it is not writing logs to application insights.
I need to find a solution for Function App isolated process for Application Insights.
i have tried this and it work fine in my local but when i deploy it in Azure, it did not log anything
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService(opt =>
{
opt.ConnectionString = applicationInsightsConectionString;
opt.DependencyCollectionOptions.EnableLegacyCorrelationHeadersInjection = true;
});
})
I ran into your post while troubleshooting the same issue. I could get "logs" from the TelemetryClient, but I couldn't seem to get
ILogger
orILogger<T>
to produce any logs.Environment:
In Program.cs:
With the
_.AddFilter("", LogLevel.Debug)
I started receiving everything I expected. There is a great post here about different ways we can configure log filtering: https://stackoverflow.com/a/64130971/90895.