0
amontalvo created
Is there a way to send error logs to azure application insights?
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
Hi amontalvo
Install the
Microsoft.ApplicationInsights.AspNetCorepackage in your project. Add the Instrumentation Key from your Azure Application Insights resource to the appsettings.json file. Application Insights by adding services.AddApplicationInsightsTelemetry() in the ConfigureServices method. Your existing ILogger setup will automatically send logs to Application Insights.Example:
appsettings.json
{ "ApplicationInsights": { "InstrumentationKey": "YOUR_INSTRUMENTATION_KEY" } }Startup.cs
public void ConfigureServices(IServiceCollection services) { //... services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:InstrumentationKey"]); //... }You can configure it this way if you only want to send error logs
"Logging": { "ApplicationInsights": { "LogLevel": { "Default": "Error" } } },Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)