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
@@ -256,17 +256,17 @@ Now, you'll configure communication between the services using Dapr [service inv
256
256
257
257
```csharp
258
258
using System;
259
-
259
+
260
260
namespace DaprFrontEnd
261
261
{
262
262
public class WeatherForecast
263
263
{
264
264
public DateTime Date { get; set; }
265
-
265
+
266
266
public int TemperatureC { get; set; }
267
-
267
+
268
268
public int TemperatureF { get; set; }
269
-
269
+
270
270
public string Summary { get; set; }
271
271
}
272
272
}
@@ -316,7 +316,7 @@ Now, you'll configure communication between the services using Dapr [service inv
316
316
@{
317
317
ViewData["Title"] = "Home page";
318
318
}
319
-
319
+
320
320
<div class="text-center">
321
321
<h1 class="display-4">Welcome</h1>
322
322
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
@@ -349,14 +349,14 @@ In the final part of this example, you'll add container support and run the solu
349
349
350
350
```yaml
351
351
version: '3.4'
352
-
352
+
353
353
services:
354
354
daprfrontend:
355
355
image: ${DOCKER_REGISTRY-}daprfrontend
356
356
build:
357
357
context: .
358
358
dockerfile: DaprFrontEnd/Dockerfile
359
-
359
+
360
360
```
361
361
362
362
The *.dockerignore* file contains file types and extensions that you don't want Docker to include in the container. These files are associated with the development environment and source control and not the app or service you're deploying.
@@ -367,14 +367,14 @@ In the final part of this example, you'll add container support and run the solu
367
367
368
368
```yaml
369
369
version: '3.4'
370
-
370
+
371
371
services:
372
372
daprfrontend:
373
373
image: ${DOCKER_REGISTRY-}daprfrontend
374
374
build:
375
375
context: .
376
376
dockerfile: DaprFrontEnd/Dockerfile
377
-
377
+
378
378
daprbackend:
379
379
image: ${DOCKER_REGISTRY-}daprbackend
380
380
build:
@@ -386,37 +386,37 @@ In the final part of this example, you'll add container support and run the solu
In the updated file, we've added `daprfrontend-dapr` and `daprbackend-dapr` sidecars for the `daprfrontend` and `daprbackend` services respectively. In the updated file, pay close attention to the following changes:
Copy file name to clipboardExpand all lines: docs/core/extensions/logging.md
+60-14Lines changed: 60 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Logging in .NET
3
3
author: IEvangelist
4
4
description: Learn how to use the logging framework provided by the Microsoft.Extensions.Logging NuGet package.
5
5
ms.author: dapine
6
-
ms.date: 09/30/2020
6
+
ms.date: 02/19/2021
7
7
---
8
8
9
9
# Logging in .NET
@@ -87,29 +87,75 @@ In the preceding sample:
87
87
88
88
### Set log level by command line, environment variables, and other configuration
89
89
90
-
Log level can be set by any of the [configuration providers](configuration-providers.md).
90
+
Log level can be set by any of the [configuration providers](configuration-providers.md). For example, you can create a persisted environment variable named `Logging:LogLevel:Microsoft` with a value of `Information`.
91
91
92
-
The following commands:
92
+
## [Command Line](#tab/command-line)
93
93
94
-
- Set the environment key `Logging:LogLevel:Microsoft` to a value of `Information` on Windows.
95
-
- Test the settings when using an app created with the .NET Worker service templates. The `dotnet run` command must be run in the project directory after using `set`.
94
+
Create and assign persisted environment variable, given the log level value.
In a *new* instance of the **PowerShell**, read the environment variable.
119
+
120
+
```powershell
121
+
# Prints the env var value
122
+
[System.Environment]::GetEnvironmentVariable(
123
+
"Logging__LogLevel__Microsoft", "Machine")
100
124
```
101
125
102
-
The preceding environment setting:
126
+
## [Bash](#tab/bash)
103
127
104
-
- Is only set in processes launched from the command window they were set in.
105
-
- Isn't read by apps launched with Visual Studio.
128
+
Create and assign persisted environment variable, given the log level value.
106
129
107
-
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.
130
+
```Bash
131
+
# Assigns the env var to the value, persists it across sessions
> When configuring environment variables with names that contain `.` (periods), consider the "Exporting a variable with a dot (.) in it" question on **Stack Exchange** and its corresponding [accepted answer](https://unix.stackexchange.com/a/93533).
147
+
148
+
---
149
+
150
+
The preceding environment setting is persisted in the environment. To test the settings when using an app created with the .NET Worker service templates, use the `dotnet run` command in the project directory after the environment variable is assigned.
151
+
152
+
```dotnetcli
153
+
dotnet run
154
+
```
155
+
156
+
> [!TIP]
157
+
> After setting an environment variable, restart your integrated development environment (IDE) to ensure that newly added environment variables are available.
158
+
113
159
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:
114
160
115
161
- Encrypted at rest and transmitted over an encrypted channel.
0 commit comments