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
The application log enricher provides application-specific enrichment. The log enricher specifically targets log telemetry and adds standardized dimensions that help identify and categorize log entries by service characteristics.
45
-
46
-
### Step-by-step configuration
42
+
## Step-by-step configuration
47
43
48
44
Follow these steps to configure the application log enricher in your application:
49
45
50
-
####1. Configure Application Metadata
46
+
### 1. Configure Application Metadata
51
47
52
48
First, configure the [Application Metadata](application-metadata.md) by calling the <xref:Microsoft.Extensions.Hosting.ApplicationMetadataHostBuilderExtensions.UseApplicationMetadata%2A> methods:
####2. Provide additional configuration (optional)
68
+
### 2. Provide additional configuration (optional)
73
69
74
70
You can provide additional configuration via `appsettings.json`. There are two properties in the [Application Metadata](application-metadata.md) that don't get values automatically: `BuildVersion` and `DeploymentRing`. If you want to use them, provide values manually:
Register the log enricher into the dependency injection container using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AddServiceLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection)>:
76
+
Register the log enricher into the dependency injection container using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AppApplicationLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection)>:
81
77
82
78
```csharp
83
-
serviceCollection.AddServiceLogEnricher();
79
+
serviceCollection.AppApplicationLogEnricher();
84
80
```
85
81
86
-
You can enable or disable individual options of the enricher using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AddServiceLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{Microsoft.Extensions.Diagnostics.Enrichment.ApplicationLogEnricherOptions})>:
82
+
You can enable or disable individual options of the enricher using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AppApplicationLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{Microsoft.Extensions.Diagnostics.Enrichment.ApplicationLogEnricherOptions})>:
And apply the configuration using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AddServiceLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.Configuration.IConfigurationSection)>:
96
+
And apply the configuration using <xref:Microsoft.Extensions.DependencyInjection.ApplicationEnricherServiceCollectionExtensions.AppApplicationLogEnricher(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.Configuration.IConfigurationSection)>:
The service log enricher supports several configuration options through the <xref:Microsoft.Extensions.Diagnostics.Enrichment.ApplicationLogEnricherOptions> class:
106
+
The application log enricher supports several configuration options through the <xref:Microsoft.Extensions.Diagnostics.Enrichment.ApplicationLogEnricherOptions> class:
111
107
112
108
| Property | Default Value | Dimension Name | Description |
description: Learn about the obsoletions that generate compile-time warning EXTOBS0002.
4
+
ms.date: 11/12/2025
5
+
f1_keywords:
6
+
- extobs0002
7
+
ai-usage: ai-assisted
8
+
---
9
+
# EXTOBS0002: AddServiceLogEnricher is obsolete
10
+
11
+
The `AddServiceLogEnricher` extension methods have been marked as obsolete starting in .NET 11. These methods had incorrect naming that didn't accurately reflect their functionality. The methods enrich application logs, not service logs, so they have been replaced with correctly named `AddApplicationLogEnricher` methods.
12
+
13
+
The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0002` at compile time.
Replace calls to `AddServiceLogEnricher` with the equivalent `AddApplicationLogEnricher` methods. The functionality remains the same, only the method names have been corrected to accurately reflect that they enrich application logs.
22
+
23
+
For more information, see [Application log enricher](../../../core/enrichment/application-log-enricher.md).
24
+
25
+
## Suppress a warning
26
+
27
+
If you must use the obsolete APIs, you can suppress the warning in code or in your project file.
28
+
29
+
To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.
30
+
31
+
```csharp
32
+
// Disable the warning.
33
+
#pragmawarningdisable EXTOBS0002
34
+
35
+
// Code that uses obsolete API.
36
+
// ...
37
+
38
+
// Re-enable the warning.
39
+
#pragmawarningrestore EXTOBS0002
40
+
```
41
+
42
+
To suppress all the `EXTOBS0002` warnings in your project, add a `<NoWarn>` property to your project file.
43
+
44
+
```xml
45
+
<ProjectSdk="Microsoft.NET.Sdk">
46
+
<PropertyGroup>
47
+
...
48
+
<NoWarn>$(NoWarn);EXTOBS0002</NoWarn>
49
+
</PropertyGroup>
50
+
</Project>
51
+
```
52
+
53
+
For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings).
0 commit comments