- Notifications
You must be signed in to change notification settings - Fork76
Open
Description
Using Serilog 3.1.1 but happens to me too with 4.0.0.
When I try to enter into this function in my own formatter:
privatevoidWriteTraceId(LogEventlogEvent,TextWriteroutput){if(!logEvent.TraceId.HasValue||!_settings.LogTraceId){return;}output.Write(',');output.Write('"');output.Write(_settings.TraceIdName);output.Write('"');output.Write(':');_jsonValueFormatter.WriteQuotedJsonString(logEvent.TraceId.Value.ToHexString(),output);}
I get the following exception:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. El sistema no puede encontrar el archivo especificado.File name: 'System.Diagnostics.DiagnosticSource, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at Link.VisiotechSerilog.Formatters.SerilogJsonFormatter.WriteTraceId(LogEvent logEvent, TextWriter output) at Link.VisiotechSerilog.Formatters.SerilogJsonFormatter.Format(LogEvent logEvent, TextWriter output) in C:\Users\chernandez\Source\visiotechserilog-module\Link.VisiotechSerilog\Link.VisiotechSerilog\Formatters\SerilogJsonFormatter.cs:line 34 at Serilog.Sinks.SystemConsole.ConsoleSink.Emit(LogEvent logEvent) at Serilog.Core.Sinks.SafeAggregateSink.Emit(LogEvent logEvent)I think the package pulls version 7.0.2 and it's trying to use 7.0.0, this is anetstandard2.1 library which uses Serilog, when we use the library in .NET 8, it works well, but when used in .NET 6 we get this exception.
If I omitTraceId orSpanId logging, it works well, but whenever any of those two properties are involved, I get the exception.
However, the properties are set, as you can see from the debugger:
If you need more info let me know and I'll try to help!
Metadata
Metadata
Assignees
Labels
No labels
