What problem does it solve?
This Skill helps you implement reliable, structured logging in .NET so startup errors are captured, log data is consistent, and events are easy to search and analyze across environments.
Core Features & Use Cases
- Two-stage initialization: Capture early startup failures with a bootstrap logger, then switch to the full DI-and-configuration logger once services are ready.
- Structured message templates: Use property-based logging (for example,
{OrderId}) instead of string interpolation so logs stay queryable and efficient.
- Config-driven sinks and enrichers: Centralize minimum levels, overrides, enrichers, and sinks in appsettings.json for environment-specific behavior without redeployments.
- Request logging and contextual enrichment: Enable HTTP request logging and attach diagnostic context (such as host, user agent, user id) to each request.
- Destructuring controls: Apply limits for depth, string length, and collection counts to prevent runaway payloads and memory-heavy logs.
Use case example: When deploying a .NET 9+ service, you want console output during development, file/rolling logs for auditing, and queryable request logs in Seq for production—without losing startup errors.
Quick Start
Load the serilog Skill and configure logging by adding the provided two-stage bootstrap logger pattern and appsettings.json Serilog configuration to your .NET application so startup, structured events, and request logging are enabled.