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
tl;dr:
When writing logs with
MS Ext Loggingand streaming them back to application as demonstrated in this library documentation, deserializing LogEvent usingLogEventReader.ReadFromJObjectfails with exception"Requested value 'Trace' was not found".long verson:
I'm using Seq as a logging storage for
Microsoft.Extensions.Loggingbased app (usingSeq.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
LogEventinstances (usingLogEventReader.ReadFromJObject) - unfortunately, the level is Serilog'sLogEventLevelwhich 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:
SeqConnection.Events.Find / Listmethods, we deal with Seq'sEventEntity(which definesLevelasstringso we're fine here)SeqConnection.Events.Streammethod we deal with the Serilog'sLogEventjson representation for some reason