From 0c3e6b97fabab72028ac14948187040d70a8be97 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 10 Apr 2024 09:44:57 -0700 Subject: [PATCH 1/3] create a branch from main which does not have the additional stderr fixes --- tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs index 90d868513bf..85c0ea1d782 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs @@ -147,12 +147,9 @@ private static void StartServer(StartOptions startOptions) { loggingBuilder.ClearProviders(); loggingBuilder.AddConfiguration(hostBuilder.Configuration.GetSection("Logging")); - loggingBuilder.AddConsole(options => + loggingBuilder.AddSimpleConsole(formatterOptions => { - options.LogToStandardErrorThreshold = startOptions.UniversalOutput ? LogLevel.None : LogLevel.Error; - }).AddSimpleConsole(options => - { - options.TimestampFormat = "[HH:mm:ss] "; + formatterOptions.TimestampFormat = "[HH:mm:ss] "; }); loggingBuilder.AddDebug(); loggingBuilder.AddEventSourceLogger(); From 64669b2d7ff92e6c48daf901821cdafa165c3439 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 10 Apr 2024 15:23:09 -0700 Subject: [PATCH 2/3] change the addition of consoles so that on universal output, stuff really doesn't make it to stderr --- tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs index 85c0ea1d782..b4285640fec 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs @@ -147,9 +147,16 @@ private static void StartServer(StartOptions startOptions) { loggingBuilder.ClearProviders(); loggingBuilder.AddConfiguration(hostBuilder.Configuration.GetSection("Logging")); - loggingBuilder.AddSimpleConsole(formatterOptions => + if (!startOptions.UniversalOutput) { - formatterOptions.TimestampFormat = "[HH:mm:ss] "; + loggingBuilder.AddConsole(options => + { + options.LogToStandardErrorThreshold = LogLevel.Error; + }); + } + loggingBuilder.AddSimpleConsole(options => + { + options.TimestampFormat = "[HH:mm:ss] "; }); loggingBuilder.AddDebug(); loggingBuilder.AddEventSourceLogger(); From f237cb3cb4048d2e81eb78d1a2b12a9902770480 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 11 Apr 2024 10:00:36 -0700 Subject: [PATCH 3/3] finally fix the weirdness with the loglevel --- .../CommandOptions/OptionsGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandOptions/OptionsGenerator.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandOptions/OptionsGenerator.cs index 35f48b6cda7..8f0ad59bb8b 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandOptions/OptionsGenerator.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandOptions/OptionsGenerator.cs @@ -50,7 +50,7 @@ public static RootCommand GenerateCommandLineOptions(Func dumpOption.AddAlias("-d"); var universalOption = new Option( - name: "--universalOutput", + name: "--universal", description: "Flag; Redirect all logs to stdout, including what would normally be showing up on stderr.", getDefaultValue: () => false); universalOption.AddAlias("-u"); @@ -83,6 +83,7 @@ public static RootCommand GenerateCommandLineOptions(Func var startCommand = new Command("start", "Start the TestProxy."); startCommand.AddOption(insecureOption); startCommand.AddOption(dumpOption); + startCommand.AddOption(universalOption); startCommand.AddArgument(collectedArgs); startCommand.SetHandler(async (startOpts) => await callback(startOpts),