ASP.NET Core Trace Logging on Azure with Application Information

I have an ASP.NET Core web project deployed to Azure with Insight setup. Insights is getting data for queries etc., but I can't get it to display my logs.

I am using the Microsoft.Extensions.Logging framework with vanilla and have a test error logging when the controller acted as

logger.LogError("Test application insights message");

      

In my Configure Startup.cs method, I have set

loggerFactory.AddAzureWebAppDiagnostics();

      

... and can successfully see the error message in Azure Streaming:

2017-04-14 11:06:00.313 +00:00 [Error] Test application insights message

      

However, I also want this message to appear on the Application Insights trace, but it is nowhere to be found. I think I need to set up an ILoggerFactory but not sure how and cannot find any docs on this.

Thanks in advance for your help

+6


source to share


1 answer


If anyone else tries to solve this problem, I got the results I want:



loggerFactory.AddApplicationInsights(app.ApplicationServices);

      

+10


source







All Articles