You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the .NET 6 aspnet container images we made the decision to default the console logger in CreateDefaultBuilder() to structured JSON logs in order to support container environments where folks use tools like fluentd or Azure Monitor to collect those logs. However, this resulted in non-human readable output that does not work well when viewing this output to analyze logs. Please see this issue for more details. We have made the decision to revert the default behavior back to multiline human-readable output.
Discussion
You can share your thoughts on this change or see what others are saying at:
In the May 2022 servicing update for .NET 6, we will change the Logging__Console__FormatterName environment variable to be unset for the ASP.NET Core container images. This will cause it to revert back to the original simple output.
Output of original .NET 6 behavior with Logging__Console__FormatterName set to Json:
{"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}"}}
Output of the upcoming .NET 6 behavior with Logging__Console__FormatterName left unset:
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
Breaking Change
Question: What do I do if this change breaks my system that relies on JSON formatting?
If you are currently using or want to use JSON, you will need to opt into this behavior since it will no longer be on by default. To do this please set the Logging__Console__FormatterName environment variable to Json.
The text was updated successfully, but these errors were encountered:
In the .NET 6
aspnet
container images we made the decision to default the console logger inCreateDefaultBuilder()
to structured JSON logs in order to support container environments where folks use tools like fluentd or Azure Monitor to collect those logs. However, this resulted in non-human readable output that does not work well when viewing this output to analyze logs. Please see this issue for more details. We have made the decision to revert the default behavior back to multiline human-readable output.Discussion
You can share your thoughts on this change or see what others are saying at:
dotnet/dotnet-docker#3642
Servicing Update
In the May 2022 servicing update for .NET 6, we will change the
Logging__Console__FormatterName
environment variable to be unset for the ASP.NET Core container images. This will cause it to revert back to the original simple output.Output of original .NET 6 behavior with
Logging__Console__FormatterName
set toJson
:Output of the upcoming .NET 6 behavior with
Logging__Console__FormatterName
left unset:Breaking Change
Question: What do I do if this change breaks my system that relies on JSON formatting?
If you are currently using or want to use JSON, you will need to opt into this behavior since it will no longer be on by default. To do this please set the
Logging__Console__FormatterName
environment variable toJson
.The text was updated successfully, but these errors were encountered: