logging-patterns

Configure Spring Boot JSON logs with MDC context for AI-assisted debugging.

700|137|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/decebals/claude-code-java --skill logging-patterns-decebals
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-patterns
Source: https://github.com/decebals/claude-code-java/tree/main/.claude/skills/logging-patterns
Command: npx skills add https://github.com/decebals/claude-code-java --skill logging-patterns-decebals

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Java teams achieve AI-friendly, observable logging by standardizing on JSON logs with MDC-based context, reducing cognitive load for Claude Code and speeding debugging.

Core Features & Use Cases

  • AI-friendly JSON logs with fields like timestamp, level, logger, message, requestId, traceId for easy AI parsing.
  • MDC-based request and user context propagation to all logs during a request flow.
  • Spring Boot 3.4+ structured logging configurations and safe log redaction practices for sensitive data.

Quick Start

Configure your Java application to emit JSON logs with MDC context and test AI-assisted log analysis on a sample request.

Frequently Asked Questions about logging-patterns

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

FAQPage Schema
How do I configure Spring Boot for structured JSON logging with MDC context?

To configure Spring Boot for structured JSON logging with MDC context, you enforce specific logback or framework configurations to output fields like timestamp, level, and traceId. This approach standardizes observability and enables consistent AI-assisted debugging across JVM services.

What is the best way to make Java application logs easier for AI to parse?

The best way to make Java application logs easier for AI to parse is by standardizing on structured JSON logs. Including MDC-based request and user context propagation in your log output ensures that AI assistants can quickly analyze and debug cross-request tracing flows.

Does this logging pattern approach work with existing SLF4J implementations in JVM services?

Yes, this logging pattern approach works with SLF4J implementations in JVM services. It applies standard structured logging configurations and MDC support to your existing logging framework, ensuring consistent JSON log formats across different environments without replacing your core logging dependency.

How do I handle sensitive data redaction in Java structured logs?

To handle sensitive data redaction in Java structured logs, you apply safe log redaction practices within your JSON logging configuration. This ensures that user context and request data propagated through MDC are sanitized before output, maintaining security during AI-assisted debugging and analysis.

When do I need MDC context propagation in my Java application logs?

You need MDC context propagation in your Java application logs when tracking cross-request tracing and user context through complex request flows. Propagating this context to all logs during a request flow reduces cognitive load for debugging and accelerates root cause analysis.