logging-best-practices

Enforce structured logging with wide events and high-cardinality fields.

6|8|Updated May 9, 2024
One-click install
npx skills add https://github.com/GELLIFY/acme-app --skill logging-best-practices-gellify
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-best-practices
Source: https://github.com/GELLIFY/acme-app/tree/main/.agents/skills/logging-best-practices
Command: npx skills add https://github.com/GELLIFY/acme-app --skill logging-best-practices-gellify

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses the challenge of creating effective, actionable logs that are crucial for debugging complex systems and performing in-depth analytics. It moves beyond basic logging to a structured, context-rich approach.

Core Features & Use Cases

  • Wide Events: Emits a single, context-rich event per request per service for powerful debugging and analytics.
  • High Cardinality & Dimensionality: Includes fields that allow for granular querying and answering unforeseen questions.
  • Business & Environment Context: Ensures logs contain vital information about users, business operations, and deployment details.
  • Use Case: Debugging a checkout failure by analyzing a single, comprehensive log event that includes user details, cart contents, payment status, and deployment information, rather than sifting through scattered, incomplete log messages.

Quick Start

Apply the logging best practices skill to ensure all new service code adheres to wide event principles.

Frequently Asked Questions about logging-best-practices

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

FAQPage Schema
What is structured logging and how does it improve debugging?

Structured logging formats logs as consistent, queryable events rather than scattered text. It improves debugging by incorporating high cardinality, business context, and environment details into a single comprehensive event per request for granular analysis.

How do I implement wide events for application observability?

Implement wide events by emitting a single, context-rich log entry per service request. Include high-dimensional business and environment characteristics to ensure comprehensive observability and answer unforeseen analytics questions.

Why are my scattered logs missing request correlation during debugging?

Scattered logs lack request correlation because they omit consistent schema design and contextual identifiers. Enforcing structured logging with wide events resolves this by binding user details, business operations, and deployment info into one traceable event.

What's the best way to add business context to structured logs?

The best way to add business context is by adopting wide events that encapsulate user details, cart contents, and payment status alongside environment characteristics. This ensures logs contain vital operational information for in-depth analytics.

When do I need high cardinality and dimensionality in log events?

You need high cardinality and dimensionality in log events when performing comprehensive debugging and analytics. This approach allows granular querying across services, enabling you to answer unforeseen questions about complex system failures.