Skip to content

Commit 14c5715

Browse files
committed
Added another blurb to the /identityserver/diagnostics/otel/ page to show how to send log messages to traces using the Serilog native api
1 parent a5a9772 commit 14c5715

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

  • src/content/docs/identityserver/diagnostics

src/content/docs/identityserver/diagnostics/otel.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,27 @@ You can select which information you are interested in by selectively listening
458458
* *`IdentityServerConstants.Tracing.Validation`*
459459

460460
More detailed tracing related to validation
461+
462+
## OpenTelemetry From 3rd Party Logging Frameworks
463+
464+
If you're unable to use the `ILogger` system in .NET, your choice of logging framework may be able to push log messages to traces. You can view their documentation to set that up.
465+
466+
### OpenTelemetry with Serilog
467+
468+
If you are logging with Serilog and want to use that framework's native API to push log messages to traces, you need to:
469+
470+
* Add the Serilog OpenTelemetry sink library
471+
* Instruct the Serilog logger object to write to the OpenTelemetry sink
472+
473+
Note: See the Serilog [OpenTelemetry sink](https://github.com/serilog/serilog-sinks-opentelemetry) documentation for the most up to date information.
474+
475+
```bash
476+
dotnet add package Serilog.Sinks.OpenTelemetry
477+
```
478+
479+
```csharp
480+
Log.Logger = new LoggerConfiguration()
481+
.WriteTo.OpenTelemetry()
482+
.CreateLogger();
483+
```
484+

0 commit comments

Comments
 (0)