net8-apirest-logging

Configure Serilog and CorrelationId middleware for ASP.NET Core 8 REST APIs.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/zeshone/zesh-one-skills --skill net8-apirest-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: net8-apirest-logging
Source: https://github.com/zeshone/zesh-one-skills/tree/main/skills/backend/logging
Command: npx skills add https://github.com/zeshone/zesh-one-skills --skill net8-apirest-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Structured logging, end-to-end traceability, and canonical exception handling for ASP.NET Core 8 REST APIs using Serilog with ProblemDetails, CorrelationId, and mandatory observability fields. Trigger: When implementing logging, configuring Serilog, writing exception handlers, adding Correlation ID tracking, or diagnosing incidents in a .NET 8 API.

Core Features & Use Cases

  • Canonical middleware pattern for correlation and error handling across the request pipeline.
  • Serilog bootstrap with structured logging, enrichers, and multi-sink outputs.
  • End-to-end traceability with CorrelationId propagation and ProblemDetails-based error responses.

Quick Start

Configure Serilog in your .NET 8 API project and wire the CorrelationIdMiddleware and ExceptionHandlingMiddleware to enable end-to-end traceability.

Frequently Asked Questions about net8-apirest-logging

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

FAQPage Schema
How do I configure structured logging in a .NET 8 REST API?

Structured logging in a .NET 8 REST API is configured by applying Serilog bootstrap with enrichers and multi-sink outputs. This ensures consistent, secure, and observable logging across all API endpoints for incident diagnosis.

What is the best way to handle exceptions and return ProblemDetails in ASP.NET Core 8?

Canonical exception handling in ASP.NET Core 8 uses middleware to generate ProblemDetails-based error responses. This pattern maintains secure API observability and standardizes error diagnostics across the request pipeline.

How do I propagate CorrelationId for end-to-end traceability in ASP.NET Core 8?

CorrelationId propagation for end-to-end traceability in ASP.NET Core 8 is achieved by wiring CorrelationIdMiddleware. This tracks requests across API endpoints to diagnose incidents and maintain full observability.

What minimum traceability fields are required for .NET 8 API observability?

.NET 8 API observability requires enforcing nine minimum traceability fields. These fields are mandated during Serilog bootstrap to ensure consistent structured logging and secure incident diagnosis.

Does Serilog work with ProblemDetails for exception handling in .NET 8?

Serilog works with ProblemDetails by using a canonical middleware pattern for correlation and error handling. This combination enables structured logging and standardized error responses across the ASP.NET Core request pipeline.