BT

Newest NLog Improves Exception Logging, Adds JSON/Zip support

| by Jeff Martin Follow 17 Followers on Jun 18, 2015. Estimated reading time: 1 minute |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT