I am working to build an API using WebAPI, and have been using NLog for logging throughout the stack. My API solution has two main projects including:
NLog.Extension.Logging ver. 1.0 is able to capture context-properties created with ILogger.BeginScope. These can be extracted using NLog ${mdlc}
.
Microsoft engine will by default inject properties like RequestId
, RequestPath
, etc.
See also: https://github.com/NLog/NLog.Extensions.Logging/wiki/NLog-properties-with-Microsoft-Extension-Logging