# logging-observability

Adds structured Serilog logging, request correlation, and HTTP request logs for ASP.NET Core Razor Pages. Use it when wiring observability into an app.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 542 installs · ★ 86
- Author: wshaddix
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/logging-observability/SKILL.md
- Updated: 2026-02-27
- HTML: https://affpapa.org/en/nevibecode/skills/logging-observability

## What it does

This skill provides logging patterns for ASP.NET Core Razor Pages with Serilog. The examples cover structured output, event levels, contextual properties, bootstrap logging, and console or Seq sinks. Request records can include the user, client IP, user agent, route, and HTTP method.

A middleware example handles `X-Correlation-Id`: it reuses the incoming value or falls back to `TraceIdentifier`, places the ID in the response, and attaches it to log context. `UseSerilogRequestLogging` records each request and assigns higher severity to server errors and slow responses.

The target stack is .NET 8+ with nullable reference types enabled. The setup uses `Serilog.AspNetCore`, `Serilog.Expressions`, and optionally `Serilog.Sinks.Seq`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill logging-observability -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/logging-observability/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/logging-observability/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill logging-observability -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/logging-observability/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill logging-observability -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/logging-observability/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install wshaddix/dotnet-skills logging-observability
```

2. **Manually: put the files in place**
- File: `.github/skills/logging-observability/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill logging-observability -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/logging-observability
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/logging-observability/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill logging-observability -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/logging-observability/SKILL.md

## When to use it
- set up structured logs in Razor Pages
- trace a request across application logs
- record HTTP requests with Serilog
- assign levels to errors and slow responses
- send log events to Seq

## Example prompts
- Set up structured Serilog logging for this ASP.NET Core Razor Pages app.
- Add middleware for `X-Correlation-Id` and log every HTTP request.
- Show an `appsettings.json` setup that writes to the console and Seq.

## Similar
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [lark-im](https://affpapa.org/en/nevibecode/skills/lark-im.md) — skill · 472900 installs
- [lark-event](https://affpapa.org/en/nevibecode/skills/lark-event.md) — skill · 466800 installs
- [caveman-discover](https://affpapa.org/en/nevibecode/skills/caveman-discover.md) — skill · 104400 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

From the same set: [wshaddix/dotnet-skills](https://affpapa.org/en/nevibecode/by/wshaddix/dotnet-skills.md) — 13 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
