Skip to content

Commit 08cb49d

Browse files
authored
Add HTTP logging middleware breaking change documentation for .NET 8 (#48786)
1 parent e8cd6a1 commit 08cb49d

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
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
5+
---
6+
# HTTP logging middleware requires AddHttpLogging()
7+
8+
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>.
9+
10+
## Version introduced
11+
12+
ASP.NET Core 8.0
13+
14+
## Previous behavior
15+
16+
Previously, you could call just `app.UseHttpLogging();` to activate HTTP logging.
17+
18+
## New behavior
19+
20+
Starting in .NET 8, if you don't also call <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A>, an error is raised:
21+
22+
> 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'.
23+
24+
## Type of breaking change
25+
26+
This change is a [behavioral change](../../categories.md#behavioral-change).
27+
28+
## Reason for change
29+
30+
Additional features were added to the HttpLogging middleware that are registered (and configurable) via the <xref:Microsoft.AspNetCore.Telemetry.HttpLoggingServiceExtensions.AddHttpLogging*> method.
31+
32+
## Recommended action
33+
34+
Call `services.AddHttpLogging()` during host construction.
35+
36+
## Affected APIs
37+
38+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ 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()
340+
href: aspnet-core/8.0/httpLogging-addhttplogging-requirement.md
339341
- name: ISystemClock is obsolete
340342
href: aspnet-core/8.0/isystemclock-obsolete.md
341343
- name: "Minimal APIs: IFormFile parameters require anti-forgery checks"

0 commit comments

Comments
 (0)