当应用程序在 Linux 操作系统下运行时,
AddEventLog
Microsoft.Extensions.Logging.ILoggingBuilder
不,不是。事件日志是特定于 Windows 的,事实上,如果您在没有明确检查 Windows 支持的情况下尝试使用它,您将在 IDE 中收到警告:
要消除警告,您可以将其包装在操作系统检查中,如下所示
if (OperatingSystem.IsWindows()) { builder.Logging.AddEventLog(); }