To inject traces in logs, enable log correlation by setting the environment variable
SIGNALFX_LOGS_INJECTION=true
before running your instrumented application.
For more information about instrumenting a .NET application, see Configure the SignalFx Tracing Library for .NET.
If your logger uses JSON, the tracing library automatically handles trace ID injection.
If your logger uses a raw format, manually configure your logger to include the trace ID and span ID. For examples that show you how to do this for each supported logger, see these configurations:
These are the supported logging frameworks.
Version 2.0.8
Layouts configured in the sample:
- JSON format:
SerializedLayout
(from thelog4net.Ext.Json
NuGet package) - Raw format:
PatternLayout
(requires manual configuration)
Versions 4.5.11 and 4.6.8
Layouts configured in the sample:
- JSON format:
JsonLayout
- Raw format: Custom layout (requires manual configuration)
Versions 2.5.0 and 2.9.0
Layouts configured in the sample:
- JSON format:
JsonFormatter
- JSON format:
CompactJsonFormatter
(from theSerilog.Formatting.Compact
NuGet package) - Raw format: output template (requires manual configuration)
trace_id
span_id
service.name
-SIGNALFX_SERVICE_NAME
configuration optiondeployment.environment
-SIGNALFX_ENV
configuration option