Supporting NLog 4.5 and structured logging

NLog 4.5 were published a little over a week ago and we want to show our support with a compatible version too. As of today, our integration (Elmah.Io.NLog) runs on NLog 4.5 and also supports the new structured logging feature available in 4.5.

All samples have been updated to NLog 4.5 and there's a new ASP.NET Core 2.0 sample available here: https://github.com/elmahio/elmah.io.nlog/tree/master/samples.

You may know structured logging from similar logging frameworks like Serilog. The awesome thing about structured log messages is, that you put semantic meaning directly in log messages, rather than a dumb string concat. Let's look have a quick look at how a structured NLog message look like:

logger.LogWarning("Endpoint requested with HTTP {method}", Request.Method);

Looking at the warning inside elmah.io, simply shows the full message:

NLog warning

When digging into the warning details, you will see the key (method) and value (GET) inside the Data tab:

Data tab

Keeping properties separated from the actual log message, opens a range of possibilities, like enhanced search.

Let us know if you experience any problems with the new version.

Download NLog Cheat Sheet

elmah.io: Error logging and Uptime Monitoring for your web apps

This blog post is brought to you by elmah.io. elmah.io is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users to notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With elmah.io, we store all of your log messages, notify you through popular channels like email, Slack, and Microsoft Teams, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website