Skip to content

Commit 5be1a9e

Browse files
committed
human edits
1 parent 1ae32fa commit 5be1a9e

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

docs/core/compatibility/8.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ If you're migrating an app to .NET 8, the breaking changes listed here might aff
1818
| [ConcurrencyLimiterMiddleware is obsolete](aspnet-core/8.0/concurrencylimitermiddleware-obsolete.md) | Source incompatible |
1919
| [Custom converters for serialization removed](aspnet-core/8.0/problemdetails-custom-converters.md) | Behavioral change |
2020
| [Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies](aspnet-core/8.0/forwarded-headers-unknown-proxies.md) | Behavioral change |
21+
| [HTTP logging middleware requires AddHttpLogging()](aspnet-core/8.0/httpLogging-addhttplogging-requirement.md) | Behavioral change |
2122
| [ISystemClock is obsolete](aspnet-core/8.0/isystemclock-obsolete.md) | Source incompatible |
2223
| [Minimal APIs: IFormFile parameters require anti-forgery checks](aspnet-core/8.0/antiforgery-checks.md) | Behavioral change |
2324
| [Rate-limiting middleware requires AddRateLimiter](aspnet-core/8.0/addratelimiter-requirement.md) | Behavioral change |
Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: "Breaking change: HTTP logging middleware requires AddHttpLogging"
3-
description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging to be called on app startup.
4-
ms.date: 11/14/2023
2+
title: "Breaking change: HTTP logging middleware requires AddHttpLogging()"
3+
description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging() to be called.
4+
ms.date: 09/29/2025
55
---
6-
# HTTP logging middleware requires AddHttpLogging
6+
# HTTP logging middleware requires AddHttpLogging()
77

88
ASP.NET Core HTTP logging middleware has been updated with extra functionality. The middleware now requires services registered with <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A>.
99

@@ -13,20 +13,11 @@ ASP.NET Core 8.0
1313

1414
## Previous behavior
1515

16-
Previously, HTTP logging could be used by calling only <xref:Microsoft.AspNetCore.Builder.HttpLoggingBuilderExtensions.UseHttpLogging%2A>:
17-
18-
```csharp
19-
var builder = WebApplication.CreateBuilder(args);
20-
21-
var app = builder.Build();
22-
app.UseHttpLogging();
23-
app.MapGet("/", () => "Hello World!");
24-
app.Run();
25-
```
16+
Previously, you could call just `app.UseHttpLogging();` to activate HTTP logging.
2617

2718
## New behavior
2819

29-
If <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A> is not called on app startup, ASP.NET Core throws an informative error:
20+
Starting in .NET 8, if you don't also call <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A>, an error is raised:
3021

3122
> System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext]' while attempting to activate 'Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware'.
3223
@@ -36,24 +27,12 @@ This change is a [behavioral change](../../categories.md#behavioral-change).
3627

3728
## Reason for change
3829

39-
Additional features were added to the HttpLogging middleware which are registered (and configurable) via the <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A> method.
30+
Additional features were added to the HttpLogging middleware that are registered (and configurable) via the <xref:Microsoft.AspNetCore.Telemetry.HttpLoggingServiceExtensions.AddHttpLogging*> method.
4031

4132
## Recommended action
4233

43-
Ensure that <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A> is called at application startup.
44-
45-
For example:
46-
47-
```csharp
48-
var builder = WebApplication.CreateBuilder(args);
49-
builder.Services.AddHttpLogging();
50-
51-
var app = builder.Build();
52-
app.UseHttpLogging();
53-
app.MapGet("/", () => "Hello World!");
54-
app.Run();
55-
```
34+
Call `services.AddHttpLogging()` during host construction.
5635

5736
## Affected APIs
5837

59-
- <xref:Microsoft.AspNetCore.Builder.HttpLoggingBuilderExtensions.UseHttpLogging%2A?displayProperty=fullName>
38+
None.

docs/core/compatibility/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ items:
336336
href: aspnet-core/8.0/problemdetails-custom-converters.md
337337
- name: Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies
338338
href: aspnet-core/8.0/forwarded-headers-unknown-proxies.md
339-
- name: HTTP logging middleware requires AddHttpLogging
339+
- name: HTTP logging middleware requires AddHttpLogging()
340340
href: aspnet-core/8.0/httpLogging-addhttplogging-requirement.md
341341
- name: ISystemClock is obsolete
342342
href: aspnet-core/8.0/isystemclock-obsolete.md

0 commit comments

Comments
 (0)