Skip to content

Commit 277c660

Browse files
Merge pull request #230247 from AaronMaxwell/aaronmax-aspnetcore-ilogger-update
Updating per engineering work item 16839087
2 parents 1f4a717 + 8cde69c commit 277c660

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

articles/azure-monitor/app/asp-net-core.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Application Insights can collect the following telemetry from your ASP.NET Core
2121
> * Heartbeats
2222
> * Logs
2323
24-
We'll use an [MVC application](/aspnet/core/tutorials/first-mvc-app) example. If you're using the [Worker Service](/aspnet/core/fundamentals/host/hosted-services#worker-service-template), use the instructions in [Application Insights for Worker Service applications](./worker-service.md).
24+
We use an [MVC application](/aspnet/core/tutorials/first-mvc-app) example. If you're using the [Worker Service](/aspnet/core/fundamentals/host/hosted-services#worker-service-template), use the instructions in [Application Insights for Worker Service applications](./worker-service.md).
2525

2626
A preview [OpenTelemetry-based .NET offering](opentelemetry-enable.md?tabs=net) is available. For more information, see [OpenTelemetry overview](opentelemetry-overview.md).
2727

@@ -285,9 +285,9 @@ This table has the full list of `ApplicationInsightsServiceOptions` settings:
285285
|EnableQuickPulseMetricStream | Enable/Disable LiveMetrics feature. | True
286286
|EnableAdaptiveSampling | Enable/Disable Adaptive Sampling. | True
287287
|EnableHeartbeat | Enable/Disable the heartbeats feature. It periodically (15-min default) sends a custom metric named `HeartbeatState` with information about the runtime like .NET version and Azure environment information, if applicable. | True
288-
|AddAutoCollectedMetricExtractor | Enable/Disable the `AutoCollectedMetrics extractor`. This telemetry processor sends pre-aggregated metrics about requests/dependencies before sampling takes place. | True
288+
|AddAutoCollectedMetricExtractor | Enable/Disable the `AutoCollectedMetrics extractor`. This telemetry processor sends preaggregated metrics about requests/dependencies before sampling takes place. | True
289289
|RequestCollectionOptions.TrackExceptions | Enable/Disable reporting of unhandled exception tracking by the request collection module. | False in NETSTANDARD2.0 (because exceptions are tracked with `ApplicationInsightsLoggerProvider`). True otherwise.
290-
|EnableDiagnosticsTelemetryModule | Enable/Disable `DiagnosticsTelemetryModule`. Disabling will cause the following settings to be ignored: `EnableHeartbeat`, `EnableAzureInstanceMetadataTelemetryModule`, and `EnableAppServicesHeartbeatTelemetryModule`. | True
290+
|EnableDiagnosticsTelemetryModule | Enable/Disable `DiagnosticsTelemetryModule`. Disabling causes the following settings to be ignored: `EnableHeartbeat`, `EnableAzureInstanceMetadataTelemetryModule`, and `EnableAppServicesHeartbeatTelemetryModule`. | True
291291

292292
For the most current list, see the [configurable settings in `ApplicationInsightsServiceOptions`](https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/NETCORE/src/Shared/Extensions/ApplicationInsightsServiceOptions.cs).
293293

@@ -348,7 +348,7 @@ public void ConfigureServices(IServiceCollection services)
348348

349349
### Remove TelemetryInitializers
350350

351-
By default, telemetry initializers are present. To remove all or specific telemetry initializers, use the following sample code *after* you call `AddApplicationInsightsTelemetry()`.
351+
By default, telemetry initializers are present. To remove all or specific telemetry initializers, use the following sample code *after* calling `AddApplicationInsightsTelemetry()`.
352352

353353
### [ASP.NET Core 6 and later](#tab/netcorenew)
354354

@@ -636,19 +636,24 @@ For more information about custom data reporting in Application Insights, see [A
636636

637637
### How do I customize ILogger logs collection?
638638

639-
By default, only `Warning` logs and more severe logs are automatically captured. To change this behavior, explicitly override the logging configuration for the provider `ApplicationInsights`, as shown in the following code. The following configuration allows Application Insights to capture all `Information` logs and more severe logs.
639+
The default setting for Application Insights is to only capture **Warning** and more severe logs.
640+
641+
Capture **Information** and more severe logs by changing the logging configuration for the Application Insights provider as follows.
640642

641643
```json
642644
{
643645
"Logging": {
644646
"LogLevel": {
645-
"Default": "Warning"
647+
"Default": "Information"
646648
},
647649
"ApplicationInsights": {
648650
"LogLevel": {
649651
"Default": "Information"
650652
}
651653
}
654+
},
655+
"ApplicationInsights": {
656+
"ConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000"
652657
}
653658
}
654659
```
@@ -669,13 +674,13 @@ For more information, see [ILogger configuration](/dotnet/core/extensions/loggin
669674

670675
### Some Visual Studio templates used the UseApplicationInsights() extension method on IWebHostBuilder to enable Application Insights. Is this usage still valid?
671676

672-
The extension method `UseApplicationInsights()` is still supported, but it's marked as obsolete in Application Insights SDK version 2.8.0 and later. It will be removed in the next major version of the SDK. To enable Application Insights telemetry, use `AddApplicationInsightsTelemetry()` because it provides overloads to control some configuration. Also, in ASP.NET Core 3.X apps, `services.AddApplicationInsightsTelemetry()` is the only way to enable Application Insights.
677+
The extension method `UseApplicationInsights()` is still supported, but it's marked as obsolete in Application Insights SDK version 2.8.0 and later. It's removed in the next major version of the SDK. To enable Application Insights telemetry, use `AddApplicationInsightsTelemetry()` because it provides overloads to control some configuration. Also, in ASP.NET Core 3.X apps, `services.AddApplicationInsightsTelemetry()` is the only way to enable Application Insights.
673678

674679
### I'm deploying my ASP.NET Core application to Web Apps. Should I still enable the Application Insights extension from Web Apps?
675680

676-
If the SDK is installed at build time as shown in this article, you don't need to enable the [Application Insights extension](./azure-web-apps.md) from the App Service portal. If the extension is installed, it will back off when it detects the SDK is already added. If you enable Application Insights from the extension, you don't have to install and update the SDK. But if you enable Application Insights by following instructions in this article, you have more flexibility because:
681+
If the SDK is installed at build time as shown in this article, you don't need to enable the [Application Insights extension](./azure-web-apps.md) from the App Service portal. If the extension is installed, it backs off when it detects the SDK is already added. If you enable Application Insights from the extension, you don't have to install and update the SDK. But if you enable Application Insights by following instructions in this article, you have more flexibility because:
677682

678-
* Application Insights telemetry will continue to work in:
683+
* Application Insights telemetry continues to work in:
679684
* All operating systems, including Windows, Linux, and Mac.
680685
* All publish modes, including self-contained or framework dependent.
681686
* All target frameworks, including the full .NET Framework.

0 commit comments

Comments
 (0)