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
Copy file name to clipboardExpand all lines: README.md
+14-12Lines changed: 14 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,10 @@ With _Serilog.AspNetCore_ installed and configured, you can write log messages d
6
6
7
7
### Instructions
8
8
9
-
**First**, install the _Serilog.AspNetCore_[NuGet package](https://www.nuget.org/packages/Serilog.AspNetCore) into your app. You will need a way to view the log messages - _Serilog.Sinks.Console_ writes these to the console; there are [many more sinks available](https://www.nuget.org/packages?q=Tags%3A%22serilog%22) on NuGet.
9
+
**First**, install the _Serilog.AspNetCore_[NuGet package](https://www.nuget.org/packages/Serilog.AspNetCore) into your app.
10
10
11
11
```shell
12
12
dotnet add package Serilog.AspNetCore
13
-
dotnet add package Serilog.Sinks.Console
14
13
```
15
14
16
15
**Next**, in your application's _Program.cs_ file, configure Serilog first. A `try`/`catch` block will ensure any configuration issues are appropriately logged:
@@ -79,9 +78,9 @@ That's it! With the level bumped up a little you will see log output resembling:
79
78
[22:14:45.741 DBG] Handled. Status code: 304 File: /css/site.css
80
79
```
81
80
82
-
Tip: to see Serilog output in the Visual Studio output window when running under IIS, select _ASP.NET Core Web Server_ from the _Show output from_ drop-down list.
81
+
**Tip:** to see Serilog output in the Visual Studio output window when running under IIS, either select _ASP.NET Core Web Server_ from the _Show output from_ drop-down list, or replace `WriteTo.Console()` in the logger configuration with `WriteTo.Debug()`.
83
82
84
-
A more complete example, showing _appsettings.json_ configuration, can be found in [the sample project here](https://github.com/serilog/serilog-aspnetcore/tree/dev/samples/EarlyInitializationSample).
83
+
A more complete example, showing `appsettings.json` configuration, can be found in [the sample project here](https://github.com/serilog/serilog-aspnetcore/tree/dev/samples/EarlyInitializationSample).
85
84
86
85
### Request logging <sup>`3.0.0-*`</sup>
87
86
@@ -162,17 +161,16 @@ This pattern has the advantage of reducing the number of log events that need to
162
161
163
162
### Inline initialization
164
163
165
-
YoucanalternativelyconfigureSeriloginline, in `BulidWebHost()`, usingadelegate as shown below:
164
+
YoucanalternativelyconfigureSeriloginline, in `BuildWebHost()`, usingadelegate as shown below:
Thishastheadvantageofmakingthe `hostingContext`'s `Configuration` object available for configuration of the logger, but at the expense of recording `Exception`s raised earlier in program startup.
173
+
Thishastheadvantageofmakingthe `hostingContext`'s `Configuration` object available for [configuration of the logger](https://github.com/serilog/serilog-settings-configuration), but at the expense of losing `Exception`s raised earlier in program startup.
0 commit comments