-
Notifications
You must be signed in to change notification settings - Fork 23
Description
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 / Listmethods, we deal with Seq'sEventEntity(which definesLevelasstringso we're fine here) - using
SeqConnection.Events.Streammethod we deal with the Serilog'sLogEventjson representation for some reason