datalust / datalust/seq-api

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

Open
#127 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
C#
Stars
86
Forks
23
PR merge metrics
No merged PRs in 30d

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 / 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented streaming example and inspect SeqConnection.Events.Stream together with LogEventReader.ReadFromJObject. Compare the streamed level values with Serilog's LogEvent representation and the EventEntity level handling in Events.Find/List. Done means streamed events can be deserialized without the reported Trace-level failure and the level behavior is consistent with the chosen representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.