Enrich Serilog log events with properties from open telemetry spans using .NET's Activity API.
This repository is now deprecated. Serilog now has the native ability to log span related data. See #332.
Enriches logs with a spans unique identifier, parent unique identifier and ASP.NET's trace unique identifier. Serilog.Enrichers.Span
is an add-on to Serilog to log exception details and custom properties that are not output in Exception.ToString()
.
Add the Serilog.Enrichers.Span NuGet package.
dotnet add package Serilog.Enrichers.Span
When setting up your logger, add the WithSpan()
line like so:
using Serilog;
using Serilog.Enrichers.Span;
ILogger logger = new LoggerConfiguration()
.Enrich.WithSpan()
.WriteTo.RollingFile(
new JsonFormatter(renderMessage: true),
@"C:\logs\log-{Date}.txt")
.CreateLogger();
Name | Operating System | Status | History |
---|---|---|---|
Azure Pipelines | Ubuntu | ||
Azure Pipelines | Mac | ||
Azure Pipelines | Windows | ||
Azure Pipelines | Overall | ||
GitHub Actions | Ubuntu, Mac & Windows | ||
AppVeyor | Ubuntu, Mac & Windows |
Please view the contributing guide for more information.