Skip to content

Event IDs Missing #28

@vickityvik

Description

@vickityvik

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions