How to include logging scope into the log file using NLog
问题 I'm using NLog.Extensions.Logging . When registering a logger factory using the method AddNLog() , it is possible to enable logging scope using NLogProviderOptions.IncludeScopes . But how to make NLog write logging scope to a file? I haven't found anything similar in the list of available layouts 回答1: An example: Log like this: // logger is here of type Microsoft.Extensions.Logging.ILogger using (logger.BeginScope(new[] { new KeyValuePair<string, object>("userid", request.UserId) })) { logger