serilog-sinks-testcorrelator icon indicating copy to clipboard operation
serilog-sinks-testcorrelator copied to clipboard

Stop storing uncorrelated `LogEvent`s.

Open MitchBodmer opened this issue 5 years ago • 2 comments

We should not store log events without any correlating context. These events are unrecoverable anyways.

MitchBodmer avatar Feb 03 '20 20:02 MitchBodmer

@ahahn95

MitchBodmer avatar Feb 03 '20 20:02 MitchBodmer

I'm running into a situation where I'm writing an integration test on .NET Core 3.1 and the AsyncLocal<> is not working (logging in a thread started by NServiceBus). It was nice to see the log events stored without the context in the debugger. I could see that logging was working, but the "magic" wasn't. Maybe store them with a Guid.Empty?

As a quick and dirty way to get over my AsyncLocal<> problem, I'm halfway tempted to call the method on the private static class LogicalCallContext.Add to add the value in the place where I am writing to a log. But it would be nice if there was an alternate mechanism that didn't rely on thread storage. Perhaps a special property added to a log entry?

jasonkenneth avatar Jul 09 '20 03:07 jasonkenneth