@@ -83,7 +83,7 @@ In this section, you set up console logging that uses the [ASP.NET Core logging
83
83
Here's the **Package Manager Console** command:
84
84
85
85
```powershell
86
- Install-Package Microsoft.Extensions.Logging.Console -version <2_X_VERSION >
86
+ Install-Package Microsoft.Extensions.Logging.Console -version <3_X_VERSION >
87
87
```
88
88
89
89
1 . In * Program.cs* , add a ` using ` statement:
@@ -92,7 +92,7 @@ In this section, you set up console logging that uses the [ASP.NET Core logging
92
92
using Microsoft .Extensions .Logging ;
93
93
```
94
94
95
- In this command, replace ` <2_X_VERSION > ` with a supported 2 .x version of the package.
95
+ In this command, replace ` <3_X_VERSION > ` with a supported 3 .x version of the package.
96
96
97
97
1 . Call the [ ` ConfigureLogging ` ] ( /dotnet/api/microsoft.aspnetcore.hosting.webhostbuilderextensions.configurelogging ) method on [ ` HostBuilder ` ] ( /dotnet/api/microsoft.extensions.hosting.hostbuilder ) . The [ ` AddConsole ` ] ( /dotnet/api/microsoft.extensions.logging.consoleloggerextensions.addconsole ) method adds console logging to the configuration.
98
98
@@ -161,22 +161,22 @@ Starting with version 3.x, you must explicitly install the Storage binding exten
161
161
1 . Right - click the project , select ** Add ** > ** New Item .. .** , choose ** Class ** , name the new C # class file * Functions .cs * , and select ** Add ** .
162
162
163
163
1 . In Functions .cs , replace the generated template with the following code :
164
-
165
- ```cs
166
- using Microsoft .Azure .WebJobs ;
167
- using Microsoft .Extensions .Logging ;
168
-
169
- namespace WebJobsSDKSample
170
- {
171
- public class Functions
172
- {
173
- public static void ProcessQueueMessage ([QueueTrigger (" queue" )] string message , ILogger logger )
174
- {
175
- logger .LogInformation (message );
176
- }
177
- }
178
- }
179
- ```
164
+
165
+ ```cs
166
+ using Microsoft .Azure .WebJobs ;
167
+ using Microsoft .Extensions .Logging ;
168
+
169
+ namespace WebJobsSDKSample
170
+ {
171
+ public class Functions
172
+ {
173
+ public static void ProcessQueueMessage ([QueueTrigger (" queue" )] string message , ILogger logger )
174
+ {
175
+ logger .LogInformation (message );
176
+ }
177
+ }
178
+ }
179
+ ```
180
180
181
181
The `QueueTrigger ` attribute tells the runtime to call this function when a new message is written on an Azure Storage queue called `queue `. The contents of the queue message are provided to the method code in the `message ` parameter . The body of the method is where you process the trigger data . In this example , the code just logs the message .
182
182
@@ -354,16 +354,17 @@ In this section, you do the following tasks to set up Application Insights loggi
354
354
355
355
To take advantage of [Application Insights ](.. / azure - monitor / app / app - insights - overview .md ) logging , update your logging code to do the following :
356
356
357
- * Add an Application Insights logging provider with default [filtering ](webjobs - sdk - how - to .md #log - filtering ); all Information and higher - level logs goes to both the console and Application Insights when you 're running locally .
357
+ * Add an Application Insights logging provider with default [filtering ](webjobs - sdk - how - to .md #log - filtering ). When running locally , all Information and higher - level logs are written to both the console and Application Insights .
358
358
* Put the [LoggerFactory ](./ webjobs - sdk - how - to .md #logging - and - monitoring ) object in a `using ` block to ensure that log output is flushed when the host exits.
359
359
360
- 1 . Install the latest stable 3.x version of the NuGet package for the Application Insights logging provider : ` Microsoft .Azure .WebJobs .Logging .ApplicationInsights ` .
360
+ 1 . Install the latest stable 3.x version of the [` Microsoft . Azure . WebJobs . Logging . ApplicationInsights ` NuGet package ]( https : // www.nuget.org/packages/ Microsoft.Azure.WebJobs.Logging.ApplicationInsights/) .
361
361
362
- Here 's the **Package Manager Console** command for version 3.0.2 :
362
+ Here 's the **Package Manager Console** command:
363
363
364
364
```powershell
365
- Install - Package Microsoft .Azure .WebJobs .Logging .ApplicationInsights - Version 3.0.2
365
+ Install - Package Microsoft .Azure .WebJobs .Logging .ApplicationInsights - Version < 3_X_VERSION >
366
366
```
367
+ In this command , replace `< 3_X_VERSION > ` with a supported version of the package .
367
368
368
369
1 . Open * Program .cs * and replace the code in the `Main ` method with the following code :
369
370
0 commit comments