Skip to content

Streaming events: can't deserialize Trace level (writing events with MS.Ext.Logging) #127

@migajek

Description

@migajek

tl;dr:
When writing logs with MS Ext Logging and streaming them back to application as demonstrated in this library documentation, deserializing LogEvent using LogEventReader.ReadFromJObject fails with exception "Requested value 'Trace' was not found".

long verson:
I'm using Seq as a logging storage for Microsoft.Extensions.Logging based app (using Seq.Extensions.Logging)
Therefore the message levels stored in Seq are levels defined by MS Ext Logging.

When streaming events back to the application, the documentation states the events should be deserialized into Serilog's LogEvent instances (using LogEventReader.ReadFromJObject) - unfortunately, the level is Serilog's LogEventLevel which is not compatible with MS Ext Logging levels (Trace vs Verbose and Critical vs Fatal)

Technical aspects of the issue aside, I find it a little inconsistent:

  • using SeqConnection.Events.Find / List methods, we deal with Seq's EventEntity (which defines Level as string so we're fine here)
  • using SeqConnection.Events.Stream method we deal with the Serilog's LogEvent json representation for some reason

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions