最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

logging - SerilogTracing generates duplicate trace id for independent requests .NET 7 - Stack Overflow

programmeradmin1浏览0评论

I added SEQ Tracing by using SerilogTracing in an ASP.NET Core 7 Web API using following code in program.cs:

var logger= new LoggerConfiguration() 
 .ReadFrom.Configuration(configuration); 

using var _ = new ActivityListenerConfiguration()
.Instrument.AspNetCoreRequests()
.Instrument.SqlClientCommands()
.TraceToSharedLogger();

and then use Serilog by calling IHostBuilder.UseSerilog().

Reference: SEQ Tracing from .NET using SerilogTracing

I've observed that some independent records share a common trace ID, even though the logs are ingested from different physical servers.

Is the current minimal configuration for tracing sufficient, or do I need to handle the trace ID manually? According to the documentation, the Activity listener configuration is added in program.cs. Is this the appropriate location for adding the Activity listener configurations?

发布评论

评论列表(0)

  1. 暂无评论