From 76f43565057f25f706b77590051cbd9dcfd2c9a7 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 28 Jul 2020 15:41:23 -0700 Subject: [PATCH 1/6] add console logger breaking change --- docs/core/compatibility/3.1-5.0.md | 5 + docs/core/compatibility/corefx.md | 5 + ...bsolete-consoleloggeroptions-properties.md | 131 ++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md diff --git a/docs/core/compatibility/3.1-5.0.md b/docs/core/compatibility/3.1-5.0.md index 9f0d38628ae55..12cddbc58163d 100644 --- a/docs/core/compatibility/3.1-5.0.md +++ b/docs/core/compatibility/3.1-5.0.md @@ -122,6 +122,7 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v ## Core .NET libraries +- [Obsolete properties on ConsoleLoggerOptions](#obsolete-properties-on-consoleloggeroptions) - [Vector\ always throws NotSupportedException for unsupported types](#vectort-always-throws-notsupportedexception-for-unsupported-types) - [Default ActivityIdFormat is W3C](#default-activityidformat-is-w3c) - [Behavior change for Vector2.Lerp and Vector4.Lerp](#behavior-change-for-vector2lerp-and-vector4lerp) @@ -129,6 +130,10 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v - [CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exist](#countersetcreatecountersetinstance-now-throws-invalidoperationexception-if-instance-already-exists) - [Microsoft.DotNet.PlatformAbstractions package removed](#microsoftdotnetplatformabstractions-package-removed) +[!INCLUDE [obsolete-consoleloggeroptions-properties](../../../includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md)] + +*** + [!INCLUDE [vectort-throws-notsupportedexception](../../../includes/core-changes/corefx/5.0/vectort-throws-notsupportedexception.md)] *** diff --git a/docs/core/compatibility/corefx.md b/docs/core/compatibility/corefx.md index 1d80006bc07f6..0829c938e467a 100644 --- a/docs/core/compatibility/corefx.md +++ b/docs/core/compatibility/corefx.md @@ -11,6 +11,7 @@ The following breaking changes are documented on this page: | Breaking change | Version introduced | | - | :-: | +| [Obsolete properties on ConsoleLoggerOptions](#obsolete-properties-on-consoleloggeroptions) | 5.0 | | [Vector\ always throws NotSupportedException for unsupported types](#vectort-always-throws-notsupportedexception-for-unsupported-types) | 5.0 | | [Default ActivityIdFormat is W3C](#default-activityidformat-is-w3c) | 5.0 | | [Behavior change for Vector2.Lerp and Vector4.Lerp](#behavior-change-for-vector2lerp-and-vector4lerp) | 5.0 | @@ -41,6 +42,10 @@ The following breaking changes are documented on this page: ## .NET 5.0 +[!INCLUDE [obsolete-consoleloggeroptions-properties](../../../includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md)] + +*** + [!INCLUDE [vectort-throws-notsupportedexception](../../../includes/core-changes/corefx/5.0/vectort-throws-notsupportedexception.md)] *** diff --git a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md new file mode 100644 index 0000000000000..61ea138a2a2e0 --- /dev/null +++ b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md @@ -0,0 +1,131 @@ +### Obsolete properties on ConsoleLoggerOptions + +The type and some properties on are now obsolete. + +#### Change description + +Starting in .NET 5.0, the type and several properties on are obsolete. The obsolete properties are: + +- +- +- +- `UseUtcTimestamp` +- + +With the introduction of new formatters, these properties are now available on the individual formatters. + +#### Reason for change + +The property is an enumeration type, which cannot represent a custom formatter. + +The remaining properties were set on and applied to both of the built-in formats for console logs. However, with the introduction of a new formatter API, it makes more sense for formatting to be represented on the formatter-specific options. This change provides better separation between the logger and logger formatters. + +#### Version introduced + +5.0 Preview 8 + +#### Recommended action + +- Use the new property in place of the property. For example: + + ```csharp + loggingBuilder.AddConsole(options => + { + options.FormatterName = ConsoleFormatterNames.Systemd; + }); + ``` + + There are several differences between and : + + - has only two possible options: `Default` and `Systemd`. + - is case insensitive and can be any string. The reserved, built-in names are `Simple`, `Systemd`, and `Json` (.NET 5.0 and later). + - `"Format": "Systemd"` maps to `"FormatterName": "Systemd"`. + - `"Format": "Default"` maps to `"FormatterName": "Simple"`. + +- For the , , , and `UseUtcTimestamp`, use the corresponding property on the new `Microsoft.Extensions.Logging.Console.JsonConsoleFormatterOptions` or `Microsoft.Extensions.Logging.Console.SimpleConsoleFormatterOptions` types instead. For example: + + ```csharp + loggingBuilder.AddSimpleConsole(options => + { + options.DisableColors = true; + }); + ``` + +For example, the following two JSON snippets show how the configuration file changes. + +Old configuration file: + +```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": "*" +} +``` + +New configuration file: + +```json +{ + "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": "*" +} +``` + +#### Category + +- Core .NET libraries +- ASP.NET + +#### Affected APIs + +- +- +- +- `UseUtcTimestamp` +- + + From 21a44763bf48554c6c6088fb47b09200dd7c131b Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 28 Jul 2020 15:44:58 -0700 Subject: [PATCH 2/6] lint --- .../corefx/5.0/obsolete-consoleloggeroptions-properties.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md index 61ea138a2a2e0..ea3ba2a9facd8 100644 --- a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md +++ b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md @@ -12,7 +12,7 @@ Starting in .NET 5.0, the -With the introduction of new formatters, these properties are now available on the individual formatters. +With the introduction of new formatters, these properties are now available on the individual formatters. #### Reason for change From 000d72931f60bc4febfe9ad99302f8d3b45e72c8 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 28 Jul 2020 15:50:49 -0700 Subject: [PATCH 3/6] review on staging --- .../corefx/5.0/obsolete-consoleloggeroptions-properties.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md index ea3ba2a9facd8..91a09fa4454dc 100644 --- a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md +++ b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md @@ -42,7 +42,7 @@ The remaining properties were set on , , , and `UseUtcTimestamp`, use the corresponding property on the new `Microsoft.Extensions.Logging.Console.JsonConsoleFormatterOptions` or `Microsoft.Extensions.Logging.Console.SimpleConsoleFormatterOptions` types instead. For example: +- For the , , , and `UseUtcTimestamp` properties, use the corresponding property on the new `Microsoft.Extensions.Logging.Console.JsonConsoleFormatterOptions` or `Microsoft.Extensions.Logging.Console.SimpleConsoleFormatterOptions` types instead. For example: ```csharp loggingBuilder.AddSimpleConsole(options => @@ -51,9 +51,7 @@ The remaining properties were set on Date: Thu, 30 Jul 2020 10:32:39 -0700 Subject: [PATCH 4/6] Make xrefs consistent --- .../5.0/obsolete-consoleloggeroptions-properties.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md index 91a09fa4454dc..5969c036cbd0c 100644 --- a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md +++ b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md @@ -9,7 +9,7 @@ Starting in .NET 5.0, the - - -- `UseUtcTimestamp` +- - With the introduction of new formatters, these properties are now available on the individual formatters. @@ -42,7 +42,7 @@ The remaining properties were set on , , , and `UseUtcTimestamp` properties, use the corresponding property on the new `Microsoft.Extensions.Logging.Console.JsonConsoleFormatterOptions` or `Microsoft.Extensions.Logging.Console.SimpleConsoleFormatterOptions` types instead. For example: +- For the , , , and properties, use the corresponding property on the new or types instead. For example: ```csharp loggingBuilder.AddSimpleConsole(options => @@ -113,7 +113,7 @@ New configuration file: - - - -- `UseUtcTimestamp` +- - From 88b20a5e2b4d92f6080cfc781eac13f542041f6c Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 30 Jul 2020 10:38:16 -0700 Subject: [PATCH 5/6] Add ConsoleFormatterOptions type --- .../corefx/5.0/obsolete-consoleloggeroptions-properties.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md index 5969c036cbd0c..803c5a3d48efc 100644 --- a/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md +++ b/includes/core-changes/corefx/5.0/obsolete-consoleloggeroptions-properties.md @@ -42,7 +42,7 @@ The remaining properties were set on , , , and properties, use the corresponding property on the new or types instead. For example: +- For the , , , and properties, use the corresponding property on the new , , or types instead. For example: ```csharp loggingBuilder.AddSimpleConsole(options => From 8d51668ac6e112009e7b9b8832f548ce9adcd9c7 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 1 Sep 2020 07:57:21 -0700 Subject: [PATCH 6/6] fix up bad merge --- docs/core/compatibility/corefx.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/core/compatibility/corefx.md b/docs/core/compatibility/corefx.md index 9b997fba73d04..14a5430feb19f 100644 --- a/docs/core/compatibility/corefx.md +++ b/docs/core/compatibility/corefx.md @@ -50,10 +50,6 @@ The following breaking changes are documented on this page: *** -[!INCLUDE [vectort-throws-notsupportedexception](../../../includes/core-changes/corefx/5.0/vectort-throws-notsupportedexception.md)] - -*** - [!INCLUDE [reference-assembly-parameter-names](../../../includes/core-changes/corefx/5.0/reference-assembly-parameter-names.md)] ***