logging-observability

Enforces structured JSON logging with correlation IDs and secret-free log output.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/balajirags/aifsd-kit --skill logging-observability-balajirags
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-observability
Source: https://github.com/balajirags/aifsd-kit/tree/main/docs/skills/logging-observability
Command: npx skills add https://github.com/balajirags/aifsd-kit --skill logging-observability-balajirags

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applications often emit unstructured, inconsistent logs that leak secrets, swallow stack traces, or drown signal in noise, making production incidents hard to trace and debug. ## Core Features & Use Cases - Structured JSON Logging Rules: Mandates JSON-to-stdout logs with required fields like timestamp, level, service, env, and message, plus parameterized logging instead of string concatenation. - Correlation ID Propagation: Binds correlation IDs into the log context (MDC) from inbound headers and forwards them on outbound HTTP calls and Kafka messages for end-to-end tracing. - Security Guardrails: Prohibits logging passwords, tokens, PII, and full request/response bodies, and defines deliberate log-level usage (DEBUG/INFO/WARN/ERROR). - Use Case: When implementing a Spring Boot service, apply these rules to add a CorrelationIdFilter, emit parameterized log statements with kv() pairs, and log exceptions once at ERROR with full stack traces. ## Quick Start Apply the logging-observability rules to review my service's logging code and rewrite it to use structured parameterized logs with correlation ID propagation.

Frequently Asked Questions about logging-observability

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

FAQPage Schema
How do I implement structured JSON logging in Spring Boot?

Use Logback with logstash-logback-encoder to emit JSON to stdout, and write parameterized statements like log.info("Stock movement recorded", kv("item_id", itemId)). Every line should include timestamp, level, service, env, and message fields.

How to propagate correlation IDs across microservices?

Bind the correlation ID into the logging context (MDC) from an inbound request header via a servlet filter, then forward it as a header on every outbound HTTP call or Kafka message. Generate a UUID when no inbound header exists.

What log level should I use for retries and failures?

Use WARN for degraded-but-functional states like retries, cache miss spikes, or slow queries, and ERROR for failed operations needing attention. Reserve DEBUG for local development only and INFO for successful business events.

Why is logging e.getMessage() instead of the exception a problem?

Logging only e.getMessage() swallows the stack trace, making the error unactionable. Log the exception once at the point it is handled, at ERROR level with the full stack trace, and never re-log it at every layer.

Can I log request bodies for debugging in production?

No. Never log full request or response bodies in deployed environments because they may contain passwords, tokens, card numbers, or other PII without the log statement's author realizing it.