Facilitating the spread of knowledge and innovation in professional software development



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


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.

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


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.

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

Community comments

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

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


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.