Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

EventLogSettings not functioning

$
0
0

Hi,

I am trying to set EventLogSettings but the log continues to write to the default Windows Logs -> Application

Using .net 3.1 to build Worker Service

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

I have also tried to add a log with powershell    New-EventLog -LogName TestLog -Source TestSource

AG


Viewing all articles
Browse latest Browse all 9386

Trending Articles