다음을 통해 공유


컨테이너 이미지의 기본 콘솔 로거 서식 지정

aspnet 컨테이너에 구성된 기본 콘솔 포맷터가 변경되었습니다.

이전 동작

.NET 6의 이전 서비스 릴리스에서는 aspnet 컨테이너 이미지가 Logging__Console__FormatterName 환경 변수를 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:\\source\\temp\\web50","State":{"Message":"Content root path: C:\\source\\temp\\web50","contentRoot":"C:\\source\\temp\\web50","{OriginalFormat}":"Content root path: {contentRoot}"}}

새 동작

.NET 6.0.5부터 aspnet 컨테이너 이미지에는 기본적으로 Logging__Console__FormatterName 환경 변수가 설정되지 않습니다. 그 결과 다음과 유사한 간단하고 인간이 읽을 수 있는 여러 줄의 콘솔 출력이 생성됩니다.

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(2022년 5월 서비스)

호환성이 손상되는 변경의 형식

이 변경은 소스 호환성에 영향을 줄 수 있습니다.

변경 이유

.NET 6 GA 릴리스에 JSON 서식을 사용하는 변경 내용이 도입되면서 dotnet/dotnet-docker#2725에 설명된 대로 원래의 간단한 서식에 의존했던 많은 시나리오를 위반했습니다.

JSON 서식을 계속 사용하려면 Logging__Console__FormatterName 환경 변수 값을 Json으로 설정하여 이를 사용하도록 컨테이너를 구성할 수 있습니다.

영향을 받는 API

없음

참고 항목