8
Writing Structured and Correlated Logs
Distributed tracing is a great tool to describe and correlate operations, but sometimes, we need to record things such as callbacks and startup configurations, or conditionally write debug information. In this chapter, we’re going to explore logs – the oldest and most popular telemetry signal that can describe anything.
First, we’ll talk about logging use cases and discover different APIs available in .NET, and then we’ll focus on ILogger – a common logging façade. We’ll learn how to use it efficiently to write structured events. We’ll see how to export logs with OpenTelemetry and write rich queries over them. Finally, we’ll explore log sampling and cost-saving strategies.
In this chapter, you’ll learn ...
Get Modern Distributed Tracing in .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.