dotnet / dotnet/core

'ILoggingBuilder' does not contain a definition for 'AddEventLog'

Open
#4,590 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

I am trying to use AddEventLog for Worker Service on ASP.NET Core 3.1.3 I have installed NuGet Microsoft.Extensions.Logging.EventLog

Problem is I am getting the error 'ILoggingBuilder' does not contain a definition for 'AddEventLog'

Here is my code:

```
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseWindowsService()
.ConfigureLogging((context, logging) =>
{
logging.AddEventLog(new EventLogSettings()
{
SourceName = "MySource",
LogName = "MyLogName"
});
})
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService();
});
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.