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?