Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 dotnet 核心库,其中包含一个采用 Microsoft.Excentions.Logging.ILogger 的类。我需要从使用 NLog 3.1 的现有 .Net 4.7 应用程序中调用它。
是否可以从 NLog3.1 获得 Ilooger?
要从使用 Microsoft Extension Logging ILogger 的 dotnet 核心库中捕获日志记录,您需要使用此 nuget-package 将 NLog 注册为日志记录提供程序:
请参阅此处的示例如何将 NLog 注册为日志记录提供程序:
但这需要您将 NLog 升级到与 NLog.Extensions.Logging 匹配的版本。