logging-best-practices

Implement wide events logging with structured JSON log entries.

1|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/aarsh21/better-issues --skill logging-best-practices-aarsh21
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-best-practices
Source: https://github.com/aarsh21/better-issues/tree/main/.agents/skills/logging-best-practices
Command: npx skills add https://github.com/aarsh21/better-issues --skill logging-best-practices-aarsh21

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and rules (resource) components.

What problem does it solve?

This Skill addresses the common challenge of ineffective logging, which hinders debugging, monitoring, and understanding application behavior. It guides users toward a robust logging strategy that provides deep insights.

Core Features & Use Cases

  • Wide Events: Implements the "wide events" or "canonical log lines" pattern for comprehensive, single-event logging per request.
  • Contextual Logging: Emphasizes including high-cardinality, high-dimensionality, business, and environment context in logs.
  • Use Case: When a critical error occurs in production, this Skill helps ensure that all relevant information (user ID, subscription tier, feature flags, commit hash, region) is captured in a single log entry, enabling rapid root cause analysis.

Quick Start

Apply the logging best practices skill to refactor the current logging implementation in the application.

Frequently Asked Questions about logging-best-practices

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

FAQPage Schema
What are wide events in structured logging and how do they improve debugging?

Wide events are comprehensive, single-event structured log entries per request that capture high cardinality, high dimensionality, business, and environment context together, enabling rapid root cause analysis and deep application insights.

How do I implement canonical log lines for better application observability?

Implement canonical log lines by consolidating scattered logs into a single JSON-formatted structured entry per request, including business context like user ID and feature flags alongside environment context for enhanced observability.

What context should I include in structured logs to fix production errors faster?

Include high cardinality and high dimensionality context such as user ID, subscription tier, feature flags, commit hash, and region in your structured JSON logs to fix production errors faster through rapid root cause analysis.

Why should I avoid scattered logs and multiple loggers in my application?

Avoid scattered logs and multiple loggers because they produce unstructured data that hinders debugging and monitoring, whereas consolidated wide events provide deep insights into application behavior during critical failures.

Does this logging approach work for refactoring existing unstructured log implementations?

Yes, you can apply these logging best practices to refactor current logging implementations by transitioning unstructured data into structured JSON wide events containing business and environment context for improved debugging.

When do I need structured JSON logging instead of plain text logs?

You need structured JSON logging when you require high dimensionality and business context within single log entries, replacing scattered plain text logs to enable comprehensive analytics and faster root cause analysis.