Training
Module
Format alphanumeric data for presentation in C# - Training
Explore basic methods in C# to format alphanumeric data.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The default console formatter that's configured in aspnet
containers has changed.
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 console output formatted similarly 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:\\source\\temp\\web50","State":{"Message":"Content root path: C:\\source\\temp\\web50","contentRoot":"C:\\source\\temp\\web50","{OriginalFormat}":"Content root path: {contentRoot}"}}
Starting in .NET 6.0.5, aspnet
container images have the Logging__Console__FormatterName
environment variable unset by default. This results in simple, multiline, human-readable console 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:\source\temp\web50
.NET 6.0.5 (May 2022 servicing)
This change can affect source compatibility.
When the change to use JSON formatting was introduced in the .NET 6 GA release, it broke many scenarios that relied on the original, simple formatting as described in dotnet/dotnet-docker#2725.
If you want to continue using the JSON formatting, you can configure your container to use it by setting the Logging__Console__FormatterName
environment variable value to Json
.
None.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Training
Module
Format alphanumeric data for presentation in C# - Training
Explore basic methods in C# to format alphanumeric data.
Documentation
Breaking change: Default ASP.NET Core port changed from 80 to 8080 - .NET
Learn about the breaking change in containers where the default ASP.NET Core port changed from 80 to 8080.
Use multiple environments in ASP.NET Core
Learn how to control app behavior across multiple environments in ASP.NET Core apps.
Breaking change: Nullable reference type annotations changed - .NET
Learn about the breaking change in ASP.NET Core 6.0 titled Nullable reference type annotations changed