BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Newest NLog Improves Exception Logging, Adds JSON/Zip support

Newest NLog Improves Exception Logging, Adds JSON/Zip support

This item in japanese

Bookmarks

The open source logging tool for .NET, NLog, has just released version 4.0.  In this release the team focused on several areas.  A big one is breaking changes made to how exception logging is performed.  Now all logging methods contain a new optional parameter with type of Exception:

Error(Exception exception, string message, params object[] args)

Conditional logging has been introduced through the Logger.ConditionalTrace(), which will be used in compiled with DEBUG setting active.  If not, logging will be removed at compile time to improve runtime performance. 

A new target has been added—zip file archives—allowing them to receive logging information.  Targeting zip files will necessitate the use of .NET 4.5 or newer.  This target joins the existing targets for the console, event log, email, databases, and ASP.NET trace. 

Summary of other features:

  • Auto load extensions
  • AllEventProperties layout renderer
  • LoggingRule final behavior (breaking change)
  • New Eventlog.EntryType
  • Numerous bug fixes

NLog is licensed under the open source BSD license, and is available on GitHub and via NuGet.  The primary open source alternative to NLog is the Apache project’s Log4Net.  It should be noted that the latest version of Log4Net (1.2.13) was released in 2013.  A somewhat dated comparison of the two logging tools is available on StackOverflow.

Rate this Article

Adoption
Style

BT