Closed miksh7 closed 1 year ago
I tried to reproduce your problem by adding the environment enricher to WorkerServiceDemo included with the sink source. The sample is on .NET 6. The problem did not occurr. The machine name column was filles correctly without double quotes.
Does it really also occurr on .NET 6? Can you provide a complete sample program to demonstrate the error?
Let me use your sample project to reproduce the issue.
Eventually, I was able to reproduce the issue. First of all, I confirm that MachineName provided by Serilog.Enrichers.Environment is written into DB correctly, i.e. without double quotes.
The issue occurred in another enricher Serilog.Enrichers.Context which has the same method .WithMachineName(). Since in most cases we enable this enrichment in the config file then we mistakenly blamed Serilog.Enrichers.Environment
"Enrich": [
"FromLogContext",
"WithMachineName"
],
I leave it to you to decide whether the bug is yours or not. Thank you!
Thanks for the feedback. Since the bug seems to be in Serilog.Enrichers.Context I kindly ask you to report it in the respective repo. I will close this issue because this problem is not related to the MSSQL sink.
We tried to log MachineName into a custom column defined as below
When we used Serilog.Enrichers.Environment with
the MachineName was saved into table with double quotes, e.g. "MyComputer".
When we used a custom property
the MachineName was saved into table as expected without double quotes, e.g. MyComputer.
Latest serilog & sink versions were used, same issue on NET Framework 4.7.2 and NET6. Ideally, we'd like to use serilog enrichers. Any suggestion how to fix the case with Serilog.Enrichers.Environment ?