logging

Implement Serilog structured logging, correlation IDs, and health endpoints in ASP.NET Core.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill logging-trossitec
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging
Source: https://github.com/Trossitec/dotnet-claude-kit/tree/main/skills/logging
Command: npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill logging-trossitec

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Observability is often missing or inconsistent in .NET apps, making it hard to debug production issues, track requests end-to-end, and verify service readiness and dependencies.

Core Features & Use Cases

  • Structured logging with Serilog — Emit log events with named properties for reliable searching, filtering, and alerting.
  • OpenTelemetry tracing and metrics guidance — Connect distributed traces and operational metrics to support root-cause analysis.
  • Health checks and correlation IDs — Provide clear /health/live and /health/ready endpoints and propagate X-Correlation-Id through requests for consistent request-level diagnostics.

Quick Start

Enable Serilog structured logging and add correlation IDs plus /health/live and /health/ready endpoints in your Program.cs.

Frequently Asked Questions about logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add structured logging with Serilog to an ASP.NET Core service?

Structured logging with Serilog in ASP.NET Core uses message templates to emit log events with named properties for reliable searching, filtering, and alerting. Configuration is applied in Program.cs to replace unstructured text with queryable data.

What is the difference between liveness and readiness health checks in .NET?

Liveness and readiness health checks in .NET separate service availability from dependency availability by exposing distinct /health/live and /health/ready endpoints. Liveness verifies the process is running, while readiness confirms required dependencies are connected and prepared for traffic.

How do I propagate a correlation ID for request tracing in ASP.NET Core?

Propagating a correlation ID for request tracing in ASP.NET Core uses middleware to pass an X-Correlation-Id header through incoming requests. This ensures consistent request-level diagnostics, allowing you to track a single request end-to-end across distributed service logs.

Can I use OpenTelemetry for tracing and metrics in a .NET app?

OpenTelemetry can be used for tracing and metrics in a .NET app by aligning operational metrics and distributed traces to support root-cause analysis. It integrates with existing logs to provide comprehensive observability and production debugging context.

What's the best way to improve production debugging in .NET services?

Improving production debugging in .NET services is best achieved by implementing observability patterns like Serilog structured events, request correlation IDs, and OpenTelemetry tracing. This combination provides end-to-end request visibility and operational confidence.