-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Description
Does Serilog not support Event IDs? I am trying to get an Event Id to display when sending logs to the console or a file. I do see logs in the Console and in files, but I am not seeing any Event IDs.
Using:
Serilog.AspNetCore - v2.1.0
Serilog.Sinks.Console - v3.1.1
Here's what I am attempting to get:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x#log-event-id
Here's an example of what I am doing:
_logger.LogInformation(ApiLoggingEvents.GetItemFound, "Found Organization {id}.", id);The output is:
[11:50:08 INF] Found Organization 5a09f468d955d272044adab6.
Here's how it's configured:
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
try
{
Log.Information("Starting API host...");
BuildWebHost(args).Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
}
finally
{
Log.CloseAndFlush();
}
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseSerilog()
.UseStartup<Startup>()
.Build();
}Metadata
Metadata
Assignees
Labels
No labels