logging

Standardize Serilog structured logging in ASP.NET Core applications.

4|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill logging-zdanovichnick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging
Source: https://github.com/zdanovichnick/dotnet-pilot/tree/main/skills/logging
Command: npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill logging-zdanovichnick

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you set up Serilog structured logging in ASP.NET Core so logs remain queryable, consistent, and safe instead of becoming messy text or leaking sensitive data.

Core Features & Use Cases

  • Serilog setup for ASP.NET Core: Configure Program.cs and appsettings.json to control minimum levels, enrich logs, and add sinks like OpenTelemetry.
  • Structured message templates: Write message templates that preserve properties (e.g., OrderId, CustomerId) rather than losing structure through string interpolation.
  • Request logging and correlation: Enable request logging middleware with consistent templates and enrich diagnostic context for troubleshooting across requests.

Quick Start

Enable Serilog request logging in Program.cs using a structured message template and configure minimum levels in appsettings.json to keep noisy framework logs under control.

Frequently Asked Questions about logging

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

FAQPage Schema
How do I configure Serilog structured logging in ASP.NET Core?

Configure Serilog structured logging in ASP.NET Core by setting up Program.cs and appsettings.json to control minimum levels, enrich logs, and add sinks like OpenTelemetry for consistent telemetry output.

Why should I use Serilog message templates instead of string interpolation?

Serilog message templates preserve structured properties like OrderId and CustomerId for queryable logs, whereas string interpolation loses structure by converting everything into flat, unsearchable text.

How do I add request logging middleware with LogContext enrichment in ASP.NET Core?

Add request logging middleware in Program.cs using structured message templates and configure LogContext enrichment to capture response status, elapsed time, and diagnostic properties per request.

Does this Serilog setup support OpenTelemetry sinks for telemetry export?

Yes, the Serilog setup supports OpenTelemetry sinks, allowing you to configure appsettings.json to enrich logs and export consistent, structured telemetry data to your observability platform.

What is the best way to control noisy framework logs in ASP.NET Core Serilog?

Control noisy framework logs by configuring safe log-level defaults in appsettings.json, setting minimum levels to suppress verbose framework noise while retaining critical application telemetry.

How does LogContext enrichment work for troubleshooting ASP.NET Core requests?

LogContext enrichment works by pushing diagnostic properties into a scoped context during request processing, ensuring all structured logs within that request carry correlation data for troubleshooting.