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:
When digging into the warning details, you will see the key (method
) and value (GET
) inside the 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.