Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 14, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/bc119df77e865998cd266d8dfef059d5 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/bc119df77e865998cd266d8dfef059d5 to your computer and use it in GitHub Desktop.
.NET Applications - Logging - Set Log Levels via Command Line
## This command is to set the environment variable temporarily
## Sets variable for only current window
## Hence, not applicable if app is run from Visual Studio
set Logging__LogLevel__Microsoft=Information
dotnet run
## Setx to persist the setting in environment variables
## The swtich /M is to set the variable at system level
## Without this switch, variable is set at user level
## If SETX is used, apps run from Visual Studio would also use this value.
setx Logging__LogLevel__Microsoft=Information /M
dotnet run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment