Share via


ConsoleLoggerOptions에서 사용되지 않는 속성

Microsoft.Extensions.Logging.Console.ConsoleLoggerFormat 형식과 ConsoleLoggerOptions의 일부 속성은 더 이상 사용되지 않습니다.

변경 내용 설명

.NET 5부터 Microsoft.Extensions.Logging.Console.ConsoleLoggerFormat 형식과 ConsoleLoggerOptions의 여러 속성은 사용되지 않습니다. 사용되지 않는 속성은 다음과 같습니다.

새 포맷터가 도입됨에 따라 이제 개별 포맷터에서 해당 속성을 사용할 수 있습니다.

변경 이유

Format 속성은 사용자 지정 포맷터를 나타낼 수 없는 열거형 형식입니다.

나머지 속성은 ConsoleLoggerOptions에서 설정되어 콘솔 로그의 기본 제공 형식에 모두 적용되었습니다. 그러나 새 포맷터 API가 도입되었으므로 포맷터별 옵션에 서식을 포함하는 것이 더 적합합니다. 이렇게 변경하면 로거와 로커 포맷터를 더 명확하게 구분할 수 있습니다.

도입된 버전

5.0

다음 두 가지 JSON 코드 조각에서는 구성 파일의 변경 내용을 보여 줍니다. 이전 구성 파일:

{
  "Logging": {
    "LogLevel": {
      "Default": "None",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    },

    "Console": {
      "LogLevel": {
        "Default": "Information"
      },
      "Format": "Systemd",
      "IncludeScopes": true,
      "TimestampFormat": "HH:mm:ss",
      "UseUtcTimestamp": true
    }
  },
  "AllowedHosts": "*"
}

새 구성 파일:

{
  "Logging": {
    "LogLevel": {
      "Default": "None",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    },

    "Console": {
      "LogLevel": {
        "Default": "Information"
      },
      "FormatterName": "Systemd",
      "FormatterOptions": {
        "IncludeScopes": true,
        "TimestampFormat": "HH:mm:ss",
        "UseUtcTimestamp": true
      }
    }
  },
  "AllowedHosts": "*"
}

영향을 받는 API