Programmer's Rules

nlog

How to install NLog in ASP.NET MVC 5 project

NLog is a convenient, cofigurable tool for logging data into databases, files and console.

nlog.NETVisual Studio

NLog is a convenient, configurable tool for logging data into databases, files and console. It can be installed on various .NET platforms, including MVC project.

1. Download NLog from NuGet repository. You can use Visual Studio NuGet manager or Package Manager Console.

2. In the Web.config file write the following inside the section configSections

and the following inside configuration (below configSections):

3. Now you can use loggers in C# classes. First declare the static object:

4. Then invoke a log from inside a method with a proper log level:

Tutorial statistics