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
## Why make this change?
- This solves issue #3257
## What is this change?
We changed the `dab start` `--LogLevel` flag to `--log-level` in order
to have it follow the conventions we already have. We also allow for the
CLI to still use the previous `--LogLevel` flag but add a warning sign
to ensure the user knows it is deprecated. Lastly, also changed all of
the comments that mention the previous `--LogLevel` and updated it to
use the new `--log-level`.
Added new `isLogLevelLegacy ` value that is passed into the
`DynamicLogLevelProvider.cs` which would then be used to add the log in
case the deprecated flag is used in an Aspire scenario. In which the
flag is passed to the dll directly and not through CLI
## How was this tested?
- [ ] Integration Tests
- [X] Unit Tests
Changed the tests that were for `--LogLevel` so they now use
`--log-level` and added a few extra cases to ensure the `--LogLevel`
flag still works
## Sample Request(s)
dab start --log-level information
dab start --LogLevel warning
Copy file name to clipboardExpand all lines: src/Cli/ConfigGenerator.cs
+19-8Lines changed: 19 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3066,10 +3066,10 @@ public static bool TryStartEngineWithOptions(StartOptions options, FileSystemRun
3066
3066
List<string>args=new()
3067
3067
{"--ConfigFileName",runtimeConfigFile};
3068
3068
3069
-
/// Add arguments for LogLevel. Only pass --LogLevel when user explicitly specified it,
3069
+
/// Add arguments for LogLevel. Only pass --log-level when user explicitly specified it,
3070
3070
/// so that MCP logging/setLevel can still adjust the level when no CLI override is present.
3071
3071
///
3072
-
/// When --LogLevel is NOT specified:
3072
+
/// When --log-level is NOT specified:
3073
3073
/// - MCP stdio mode: Service defaults to None for clean stdout output
3074
3074
/// - Non-MCP mode: Service defaults to Debug (Development) or Error (Production) based on config
3075
3075
LogLevelminimumLogLevel;
@@ -3079,19 +3079,30 @@ public static bool TryStartEngineWithOptions(StartOptions options, FileSystemRun
3079
3079
Utils.IsConfigOverriding=false;
3080
3080
Utils.ConfigLogLevel=LogLevel.Information;
3081
3081
3082
+
LogLevel?logLevel=null;
3082
3083
if(options.LogLevelis not null)
3083
3084
{
3084
-
if(options.LogLevelis<LogLevel.Trace or >LogLevel.None)
3085
+
logLevel=options.LogLevel;
3086
+
}
3087
+
elseif(options.LogLevelLegacyis not null)
3088
+
{
3089
+
options.CliBuffer.BufferLog(LogLevel.Warning,$"--LogLevel is deprecated, please use --log-level instead.");
3090
+
logLevel=options.LogLevelLegacy;
3091
+
}
3092
+
3093
+
if(logLevelis not null)
3094
+
{
3095
+
if(logLevelis<LogLevel.Trace or >LogLevel.None)
3085
3096
{
3086
3097
options.CliBuffer.BufferLog(LogLevel.Error,
3087
-
$"LogLevel's valid range is 0 to 6, your value: {options.LogLevel}, see: https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.loglevel");
3098
+
$"LogLevel's valid range is 0 to 6, your value: {logLevel}, see: https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.loglevel");
3088
3099
returnfalse;
3089
3100
}
3090
3101
3091
-
minimumLogLevel=(LogLevel)options.LogLevel;
3092
-
// Only add --LogLevel when user explicitly specified it via CLI.
3102
+
minimumLogLevel=(LogLevel)logLevel;
3103
+
// Only add --log-level when user explicitly specified it via CLI.
3093
3104
// This allows MCP logging/setLevel to work when no CLI override is present.
3094
-
args.Add("--LogLevel");
3105
+
args.Add("--log-level");
3095
3106
args.Add(minimumLogLevel.ToString());
3096
3107
}
3097
3108
else
@@ -3100,7 +3111,7 @@ public static bool TryStartEngineWithOptions(StartOptions options, FileSystemRun
3100
3111
3101
3112
// Track whether config explicitly set a log level. In MCP stdio mode this
3102
3113
// allows CLI logs to be emitted to stderr (instead of being suppressed)
3103
-
// when the user expressed intent via the config file rather than --LogLevel.
3114
+
// when the user expressed intent via the config file rather than --log-level.
0 commit comments