Skip to content

Conversation

DarylBeaumont
Copy link
Contributor

@DarylBeaumont DarylBeaumont commented Oct 14, 2025

Summary

The previous approach, builder.Logging.AddConsole(options => options.IncludeScopes = true);, using ConsoleLoggerFormat was deprecated in .NET 5. It's now recommended to use ConsoleFormatterOptions (see Console log formatting).

Fixes #49141


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/logging.md Logging in C# and .NET

The previous approach, `builder.Logging.AddConsole(options => options.IncludeScopes = true);`, using `ConsoleLoggerFormat` was [deprecated in .NET 5](https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/5.0/obsolete-consoleloggeroptions-properties). It now recommends `ConsoleFormatterOptions`.
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 21:53
@DarylBeaumont DarylBeaumont requested review from a team and IEvangelist as code owners October 14, 2025 21:53
@dotnetrepoman dotnetrepoman bot added this to the October 2025 milestone Oct 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the logging configuration example to use the modern approach for console logging with scopes enabled. The change replaces the deprecated AddConsole method with AddSimpleConsole to align with current .NET best practices.

Key Changes:

  • Replaced deprecated AddConsole method call with AddSimpleConsole

@dotnet-policy-service dotnet-policy-service bot added dotnet-fundamentals/svc community-contribution Indicates PR is created by someone from the .NET community. labels Oct 14, 2025
@IEvangelist IEvangelist enabled auto-merge (squash) October 16, 2025 13:33
@IEvangelist IEvangelist merged commit c266c41 into dotnet:main Oct 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-fundamentals/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example for logging scope uses deprecated approach

2 participants