|
20 | 20 |
|
21 | 21 | ## NLog.Extensions.Logging |
22 | 22 |
|
23 | | -[NLog](https://github.com/NLog/NLog) provider for [Microsoft.Extensions.Logging](https://github.com/aspnet/Logging); .NET Core. |
24 | | -**ASP.NET Core** users should install [NLog.Web.AspNetCore](https://www.nuget.org/packages/NLog.web.aspnetcore). |
| 23 | +[NLog.Extensions.Logging](https://www.nuget.org/packages/NLog.Extensions.Logging) makes it possible to use NLog together with [Microsoft ILogger](https://github.com/NLog/NLog.Extensions.Logging/wiki/NLog-GetCurrentClassLogger-and-Microsoft-ILogger)-abstraction and Dependency Injection. |
| 24 | +It provides extension methods to register NLog as LoggingProvider for Microsoft Extension Logging using `AddNLog()` or `UseNLog()`. |
| 25 | +> Note if using **ASP.NET Core** then instead install [NLog.Web.AspNetCore](https://www.nuget.org/packages/NLog.web.aspnetcore). |
25 | 26 |
|
26 | | -## Getting started |
| 27 | +[NLog.Extensions.Logging](https://www.nuget.org/packages/NLog.Extensions.Logging) also makes it possible to load [NLog Configurations from appsettings.json](https://github.com/NLog/NLog.Extensions.Logging/wiki/NLog-configuration-with-appsettings.json) |
27 | 28 |
|
28 | | -**Note**: Microsoft haven't ported all their classes to .NET standard, so not every target/layout renderer is available. |
29 | | -Please check [platform support](https://github.com/NLog/NLog/wiki/platform-support) |
| 29 | +Notice the standard [NLog NuGet package](https://www.nuget.org/packages/NLog) is enough for using NLog Logger with simple console application on the .NET Core platform. |
| 30 | +Just add `NLog.config` file to the project, and follow the [tutorial](https://github.com/NLog/NLog/wiki/Tutorial#configure-nlog-targets-for-output) for using `GetCurrentClassLogger()`. |
30 | 31 |
|
31 | | -### ASP.NET Core |
| 32 | +### Getting Started Tutorials: |
32 | 33 |
|
33 | 34 | - [Getting started for ASP.NET Core 6](https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-6) |
34 | 35 | - [Getting started for ASP.NET Core 5](https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5) |
35 | 36 | - [Getting started for ASP.NET Core 3](https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-3) |
36 | 37 | - [Getting started for ASP.NET Core 2](https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-2) |
37 | 38 | - [Getting started for .NET Core 2 Console application](https://github.com/NLog/NLog/wiki/Getting-started-with-.NET-Core-2---Console-application) |
38 | 39 | - [How to use structured logging](https://github.com/NLog/NLog/wiki/How-to-use-structured-logging) |
39 | | -- [Multiple blogs to get started with ASP.NET Core and NLog](https://github.com/damienbod/AspNetCoreNlog) |
40 | | - |
41 | | -### .NET Core Console application |
42 | | - |
43 | | -You can choose whether or not to use Dependency Injection when using NLog in a .NET Core Console application. If you don't want to use DI, you can just add the [NLog NuGet package](https://www.nuget.org/packages/NLog) to your project, manually add an `NLog.config` file, follow this [tutorial](https://github.com/NLog/NLog/wiki/Tutorial#configure-nlog-targets-for-output) to `GetCurrentClassLogger()`, and use that for logging. |
44 | | - |
45 | | -To use DI, you can use NLog in conjunction with `Microsoft.Extensions.Logging` by following the 'getting started' tutorial below. |
46 | | - |
47 | | -- [Getting started with .NET Core 2 Console application](https://github.com/NLog/NLog.Extensions.Logging/wiki/Getting-started-with-.NET-Core-2---Console-application) |
48 | | - |
49 | | - |
50 | | -Known issues |
51 | | ---- |
52 | | -- auto load of NLog extensions won't work yet. Use `<extensions>` (see [docs](https://github.com/NLog/NLog/wiki/Configuration-file#extensions)) |
53 | | -- note: auto loading of extensions is removed in NLog 5. See [NLog 5.0 Preview-1 ready for release testing](https://nlog-project.org/2021/08/25/nlog-5-0-preview1-ready.html) |
54 | | - |
55 | | - |
56 | | -### How to run the examples |
57 | | -How to run the [dotnet-core-examples](https://github.com/NLog/NLog.Extensions.Logging/tree/master/examples): |
58 | | - |
59 | | -1. Install dotnet: http://dot.net |
60 | | -2. From source: `dotnet run` |
| 40 | +- [Blog posts for how to get started with ASP.NET Core and NLog](https://github.com/damienbod/AspNetCoreNlog) |
0 commit comments