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
We have a .NET 8 function app (isolated). When the app starts we register this lifetime callbacks:
public static IHost InitializeLogging(this IHost @this)
{
var logger = @this.Services.GetRequiredService<ILogger<ApplicationLog>>();
var lifetime = @this.Services.GetRequiredService<IHostApplicationLifetime>();
lifetime.ApplicationStarted.Register(() => logger.LogInformation("Application started"));
lifetime.ApplicationStopping.Register(() => logger.LogInformation("Application stopping"));
lifetime.ApplicationStopped.Register(() => logger.LogInformation("Application stopped"));
return @this;
}
In this application we also have configured Application Insights logging using services.AddApplicationInsightsTelemetryWorkerService()/services.ConfigureFunctionsApplicationInsights().
All in all, logging works just fine and we get all our log in AI. "Application started" is getting to AI as well. But we never get "Application stopping"/"Application stopped" in AI. My assumption is that the function app exits before those message are actually transmitted to AI server. Is this correct? Is there any way to fix this behavior?
Steps to reproduce
Create an Azure Function app.
Add Application insights logging.
Log lifetime events
Deploy Function app to Azure and run it.
Make sure its stopped.
Examine AI logs.
The text was updated successfully, but these errors were encountered:
@liliankasem I've done some additional testing and i can confirm that ApplicationStopping & ApplicationStopped events are fired indeed. So the problem (most likely) is in some events not reaching AI indeed. I think, we need some fix for this
Description
We have a .NET 8 function app (isolated). When the app starts we register this lifetime callbacks:
In this application we also have configured Application Insights logging using services.AddApplicationInsightsTelemetryWorkerService()/services.ConfigureFunctionsApplicationInsights().
All in all, logging works just fine and we get all our log in AI. "Application started" is getting to AI as well. But we never get "Application stopping"/"Application stopped" in AI. My assumption is that the function app exits before those message are actually transmitted to AI server. Is this correct? Is there any way to fix this behavior?
Steps to reproduce
The text was updated successfully, but these errors were encountered: