Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change]: Revert the Console Formatter Default in .NET 6 Containers #29243

Closed
1 of 2 tasks
mthalman opened this issue May 2, 2022 · 1 comment · Fixed by #29256
Closed
1 of 2 tasks

[Breaking change]: Revert the Console Formatter Default in .NET 6 Containers #29243

mthalman opened this issue May 2, 2022 · 1 comment · Fixed by #29256
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 source incompatible Source code may encounter a breaking change in behavior when targeting the new version.

Comments

@mthalman
Copy link
Member

mthalman commented May 2, 2022

Description

The breaking change will occur in .NET 6.0.5 (May 2022 servicing) and is related to the default console formatter configured in aspnet containers. See dotnet/dotnet-docker#3706 for details.

Version

Other (please put exact version in description textbox)

Previous behavior

In previous servicing releases of .NET 6, aspnet container images were configured with the Logging__Console__FormatterName environment variable set to Json. This resulted in the console output similar to the following:

{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://localhost:7000/","State":{"Message":"Now listening on: http://localhost:7000/","address":"http://localhost:7000/","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://localhost:7001/","State":{"Message":"Now listening on: http://localhost:7001/","address":"http://localhost:7001/","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://localhost:7002/","State":{"Message":"Now listening on: http://localhost:7002/","address":"http://localhost:7002/","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Development","State":{"Message":"Hosting environment: Development","envName":"Development","{OriginalFormat}":"Hosting environment: {envName}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: C:\\Users\\shirh\\source\\temp\\web50","State":{"Message":"Content root path: C:\\Users\\shirh\\source\\temp\\web50","contentRoot":"C:\\Users\\shirh\\source\\temp\\web50","{OriginalFormat}":"Content root path: {contentRoot}"}}

New behavior

Starting in .NET 6.0.5, aspnet containers will revert the Logging__Console__FormatterName change and leave it unset, resulting in output similar to the following:

warn: Microsoft.AspNetCore.Server.HttpSys.MessagePump[37]
      Overriding address(es) ''. Binding to endpoints added to UrlPrefixes instead.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:7000/
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:7001/
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:7002/
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\shirh\source\temp\web50

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

When the change to use JSON formatting was made in the .NET 6 GA release, this broken many scenarios that relied on the original simple formatting as described in dotnet/dotnet-docker#2725.

Recommended action

If users do not want this change and want to continue using the JSON formatting, they can configure their container to use this by setting the Logging__Console__FormatterName environment variable to Json.

Feature area

Other (please put exact area in description textbox)

Affected APIs

No response

@mthalman mthalman added doc-idea Indicates issues that are suggestions for new topics [org][type][category] breaking-change Indicates a .NET Core breaking change Pri1 High priority, do before Pri2 and Pri3 labels May 2, 2022
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release labels May 2, 2022
@gewarren gewarren removed the ⌚ Not Triaged Not triaged label May 2, 2022
@dotnet-bot dotnet-bot added the source incompatible Source code may encounter a breaking change in behavior when targeting the new version. label May 2, 2022
@gewarren
Copy link
Contributor

gewarren commented May 2, 2022

Related to #27906.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 source incompatible Source code may encounter a breaking change in behavior when targeting the new version.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants