Agent skill · writing content · aj-geddes
logging-best-practices
Implement structured logging with JSON formats, log levels (DEBUG, INFO, WARN, ERROR), contextual logging, PII handling, and centralized logging. Use for logging, observability, log levels, structured logs, or debugging.
Why this skill is useful
Provides domain-specific knowledge on structured logging practices and implementation patterns that the AI wouldn't reliably generate on its own.
What it needs
About 2k tokens when loaded. Last updated 2026-03-04. 307 stars on the source repository.
What this skill does
Logging Best Practices Table of Contents Overview When to Use Quick Start Reference Guides Best Practices Overview Comprehensive guide to implementing structured, secure, and performant logging across applications. Covers log levels, structured logging formats, contextual information, PII protection, and centralized logging systems. When to Use Setting up application logging infrastructure Implementing structured logging Configuring log levels for different environments Managing sensitive data in logs Setting up centralized logging Implementing distributed tracing Debugging production issues Compliance with logging regulations Quick Start Minimal working example: Reference Guides Detailed implementations in the references/ directory: Guide Contents --- --- Log Levels Log Levels Structured Logging (JSON) Structured Logging (JSON) Contextual Logging Contextual Logging PII and Sensitive Data Handling PII and Sensitive Data Handling Performance Logging Performance Logging Centralized Logging Centralized Logging Distributed Tracing Distributed Tracing Log Sampling (High-Volume Services) Log Sampling (High-Volume Services) Best Practices ✅ DO Use structured logging (JSON) in production Include correlation/request IDs in all logs Log at appropriate levels (don't overuse DEBUG) Redact sensitive data (PII, passwords, tokens) Include context (userId, requestId, etc.) Log errors with full stack traces Use centralized logging in distributed systems Set up log rotation to manage disk space Monitor log volume and costs Use async logging for performance Include timestamps in ISO 8601 format Log business events (user actions, transactions) Set up alerts for error patterns ❌ DON'T Log passwords, tokens, or sensitive data Use console.log in production Log at DEBUG level in production by default Log inside tight loops (use sampling) Include PII without anonymization Ignore log rotation (disk will fill up) Use synchronous logging in hot paths Log to multiple transports without need For …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aj-geddes/logging-best-practices