logging-best-practices

Guide developers in implementing structured wide events for application logging.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/Likas07/t3code-skills --skill logging-best-practices-likas07
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-best-practices
Source: https://github.com/Likas07/t3code-skills/tree/main/skills/logging-best-practices
Command: npx skills add https://github.com/Likas07/t3code-skills --skill logging-best-practices-likas07

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides a comprehensive guide to implementing effective application logging, focusing on structured, context-rich "wide events" to simplify debugging and improve observability.

Core Features & Use Cases

  • Structured Logging: Learn to emit single, context-rich events per request.
  • Contextual Data: Understand the importance of high cardinality, business context, and environment details.
  • Anti-Patterns: Identify and avoid common logging mistakes like scattered logs and unstructured strings.
  • Use Case: When setting up logging for a new microservice, use this Skill to ensure all necessary context (request ID, user info, business data, environment details) is captured in a single, queryable log event.

Quick Start

Use the logging-best-practices skill to implement structured logging for your application.

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 do wide events improve observability?

Structured logging emits single, context-rich wide events per request to improve observability. By capturing high cardinality data, business context, and environment details in JSON format, wide events replace scattered logs to simplify debugging.

How do I implement structured logging for a new microservice?

Implement structured logging by using a single logger instance and middleware patterns to capture request ID, user info, and business data. This approach ensures all context is emitted in one queryable JSON event per request.

What are common anti-patterns to avoid when setting up application logging?

Common application logging anti-patterns include emitting scattered logs across multiple statements and using unstructured strings. These practices hinder debugging by fragmenting context and preventing efficient querying of high cardinality data.

Why should I use a single logger instance instead of multiple loggers?

Using a single logger instance ensures consistent structured logging and prevents scattered logs. It allows middleware to reliably attach business context, environment characteristics, and request IDs to one wide event for better observability.

What context should I include in a canonical log event for debugging?

A canonical log event should include high cardinality fields, business context, request IDs, user information, and environment characteristics. Capturing this contextual data in a single JSON event prevents scattered logs and accelerates debugging.