I've installed the Serilog.Sinks.EventLog
sink into a little Background Worker Service project. However, none of the logs which I am attempting to write are showing up in the Event Log.
This is the body of my Main method. The RecurringTasks.Service
which is specified as the source has already been created (by me manually).
Log.Logger = new LoggerConfiguration()
.WriteTo.EventLog(source: "RecurringTasks.Service", logName: "Application")
.CreateLogger();
Log.Logger.Information("Test message");
try
{
var host = CreateHostBuilder(Log.Logger, args).Build();
host.Run();
}
catch (Exception e)
{
Log.Fatal(e, "Host terminated unexpectedly");
}
finally
{
Log.CloseAndFlush();
}
Any ideas as to why the "test" message was not written to the EventLog? Cheers