logging-patterns

仓库创建 2026年1月30日最近提交 5 个月前SkillHot 收录 23 天前
▸ 精选理由

有助于定位问题并提高日志对 AI 分析的可读性。

这个 Skill 做什么

为 Java 提供结构化日志、MDC 请求追踪与 AI 可解析的日志格式建议。

为 Java 应用提供结构化日志方案:用 SLF4J、JSON 结构化日志和 MDC 做请求追踪,并输出对 AI(如 Claude Code)友好的格式。需要排查应用流、做链路追踪或让模型自动解析日志时会用到。重点在于兼顾人可读性、可关联性和机器可解析性,方便自动化分析与定位问题。

▸ 展开 SKILL.md 英文原文

Java logging best practices with SLF4J, structured logging (JSON), and MDC for request tracing. Includes AI-friendly log formats for Claude Code debugging. Use when user asks about logging, debugging application flow, or analyzing logs.

开发编程日志结构化日志追踪通用
692
Stars
135
Forks
18
仓库内 Skill
+20
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/decebals/claude-code-java/main/.claude/skills/logging-patterns/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/decebals/claude-code-java/main/.claude/skills/logging-patterns/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Logging Patterns Skill

Effective logging for Java applications with focus on structured, AI-parsable formats.

## When to Use
- User says "add logging" / "improve logs" / "debug this"
- Analyzing application flow from logs
- Setting up structured logging (JSON)
- Request tracing with correlation IDs
- AI/Claude Code needs to analyze application behavior

---

## AI-Friendly Logging

> **Key insight:** JSON logs are better for AI analysis - faster parsing, fewer tokens, direct field access.

### Why JSON for AI/Claude Code?

```
# Text format - AI must "interpret" the string
2026-01-29 10:15:30 INFO OrderService - Order 12345 created for user-789, total: 99.99

# JSON format - AI extracts 
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有