Skip to content

Commit 2aed546

Browse files
Env sample for logging (#18316)
* Env sample for logging * Env sample for logging * Apply suggestions from code review Co-authored-by: Kirk Larkin <6025110+serpent5@users.noreply.github.com> * Update aspnetcore/fundamentals/logging/index.md Co-authored-by: Kirk Larkin <6025110+serpent5@users.noreply.github.com> Co-authored-by: Kirk Larkin <6025110+serpent5@users.noreply.github.com>
1 parent f973c42 commit 2aed546

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

aspnetcore/fundamentals/logging/index.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,39 @@ In the preceding sample:
132132

133133
## Set log level by command line, environment variables, and other configuration
134134

135-
Log level can be set by any of the [configuration providers](xref:fundamentals/configuration/index). For information on configuring the logging providers using the command line, environment variables, other file formats, and more, see <xref:fundamentals/configuration/index>.
135+
Log level can be set by any of the [configuration providers](xref:fundamentals/configuration/index).
136+
137+
[!INCLUDE[](~/includes/environmentVarableColon.md)]
138+
139+
The following commands:
140+
141+
* Set the environment key `Logging:LogLevel:Microsoft` to a value of `Information` on Windows.
142+
* Test the settings when using an app created with the ASP.NET Core web application templates. The `dotnet run` command must be run in the project directory after using `set`.
143+
144+
```cmd
145+
set Logging__LogLevel__Microsoft=Information
146+
dotnet run
147+
```
148+
149+
The preceding environment setting:
150+
151+
* Is only set in processes launched from the command window they were set in.
152+
* Isn't read by browsers launched with Visual Studio.
153+
154+
The following [setx](/windows-server/administration/windows-commands/setx) command also sets the environment key and value on Windows. Unlike `set`, `setx` settings are persisted. The `/M` switch sets the variable in the system environment. If `/M` isn't used, a user environment variable is set.
155+
156+
```cmd
157+
setx Logging__LogLevel__Microsoft=Information /M
158+
```
159+
160+
On [Azure App Service](https://azure.microsoft.com/services/app-service/), select **New application setting** on the **Settings > Configuration** page. Azure App Service application settings are:
161+
162+
* Encrypted at rest and transmitted over an encrypted channel.
163+
* Exposed as environment variables.
164+
165+
For more information, see [Azure Apps: Override app configuration using the Azure Portal](xref:host-and-deploy/azure-apps/index#override-app-configuration-using-the-azure-portal).
166+
167+
For more information on setting ASP.NET Core configuration values using environment variables, see [environment variables](xref:fundamentals/configuration/index#environment-variables). For information on using other configuration sources, including the command line, Azure Key Vault, Azure App Configuration, other file formats, and more, see <xref:fundamentals/configuration/index>.
136168

137169
## How filtering rules are applied
138170

0 commit comments

Comments
 (0)