NLog is a free logging platform for .NET with rich log routing and management capabilities. It makes it easy to produce and manage high-quality logs for your application regardless of its size or complexity.

NLog is open source software, licensed under the terms of BSD license

Why NLog?

  • Logging setup in 5 minutes with NLog (very easy to configure, both through configuration file and programmatically)
  • Easy-to-use logger pattern known from log4xxx
  • Supports all log levels including Tracing.
    * Cross-platform support: .NET Framework, .NET Compact Framework and Mono (on Windows and Unix)
  • Configuration is just simple when compared to other logging frameworks i.e. EntLib, Log4Net
  • Many Layout formats including custom layouts
  • Active release and support
  • Supports extentions, wrappers and custom methods to integrate logging with domain in any ways.
  • Advanced routing using buffering, asynchronous logging, load balancing, failover, and more
  • Easy integration with monitoring tools i.e. Sentinel or Harvester
  • Easy integration with Windows Log Notification tool i.e. Growl

NLog can be dowloaded using Nuget or the '.msi' package. For the case of downloaded the installation package, default item templates were installed and integrated with visual studio automatically to quickly add NLog Configuration File to your project. In case of Nuget, Nlog.config file can be installed seperately, which adds the related '.xsd' file by default.

Download thru Nuget, will automatically add the config file into the project or just make a config called NLog.config in the root of the project.

When editing the configuration file, reference the XSD and you'll get intellisense and inline comments in Visual Studio: Right-click the config → Properties → Schemas → “C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\NLog.xsd”

NLog requires the config file to be copied into the output directory, so make sure the “Copy to Output Directory” property is set to “Copy Always” to avoid many tears wondering why the logging doesn't work.

NLog deals with 2 APIs (Logging API and Configuration API), which hepls to handle both objects seperately and integrate at any log levels and log sources.

  • /home/skysigal/public_html/data/pages/it/ad/nlog/home.txt
  • Last modified: 2023/11/04 03:27
  • by