Logging best practices
Skill ulpi-io/plugin-marketplace/plugins/aj-geddes/skills/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.From its SKILL.md
npx -y skills add ulpi-io/plugin-marketplace --skill logging-best-practicesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.7 KB, 786 tokens by cl100k_base, as published. Nobody here has run it
Logging Best Practices
Table of Contents
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:
// logger.ts
enum LogLevel {
DEBUG = 0, // Detailed information for debugging
INFO = 1, // General informational messages
WARN = 2, // Warning messages, potentially harmful
ERROR = 3, // Error messages, application can continue
FATAL = 4, // Critical errors, application must stop
}
class Logger {
constructor(private minLevel: LogLevel = LogLevel.INFO) {}
debug(message: string, context?: object) {
if (this.minLevel <= LogLevel.DEBUG) {
this.log(LogLevel.DEBUG, message, context);
}
}
info(message: string, context?: object) {
if (this.minLevel <= LogLevel.INFO) {
this.log(LogLevel.INFO, message, context);
}
}
warn(message: string, context?: object) {
// ... (see reference guides for full implementation)
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
- Forget to include error stack traces
- Log binary data or large objects
- Use string concatenation (use structured fields)
- Log every single request in high-volume APIs
What ships with it: 10 files
16.2 KB alongside SKILL.md, 1 of them executable
references/
scripts/
- health-check.shruns383 B
templates/
Gives 2 of the 12 instructions most log analysis skills give in 786 tokens
Counted across 325 of the 341 authors here whose files we hold, read 2026-09-06
- Use structured JSON logginghere, and in 32 of 325, across 30 files
- Link every alert to a runbookin 15 of 325, across 13 files
- Alert on symptoms, not causesin 11 of 325, across 10 files
- Include correlation IDs in every log linehere, and in 10 of 325
- Propagate trace context across service boundariesin 9 of 325, across 8 files
- Include request IDs for correlationin 8 of 325, across 6 files
- Include trace_id in every structured log entryin 8 of 325, across 7 files
- Include request and user context in every log entryin 8 of 325
- Correlate logs and traces with shared trace IDin 7 of 325, across 6 files
- Record exceptions and set span status on errorsin 7 of 325
- Confirm connection is ACTIVE before running workflowsin 6 of 325, across 3 files
- Call RUBE_SEARCH_TOOLS first for current schemasin 6 of 325, across 3 files
Said here and by no other author read
- include context like userId and requestId
- use centralized logging in distributed systems
- set up log rotation to manage disk space
- monitor log volume and costs
- log business events and transactions
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.