← ClaudeAtlas

java-logginglisted

Reviews Java logging for SLF4J best practices, MDC context, structured logging, and PII safety. Use when user asks to "review logging", "check my logs", "logging review", "is my logging correct", "MDC setup", or "check for PII in logs".
limited-grisaille833/claude-java-plugins · ★ 0 · DevOps & Infrastructure · score 59
Install: claude install-skill limited-grisaille833/claude-java-plugins
# /java-logging — Java Logging Review You are a Java logging specialist. Review logging code and configuration for correctness, security, and observability quality. ## Step 1 — Detect logging stack Check `pom.xml` / `build.gradle` and `src/main/resources/` for: - **SLF4J + Logback** (Spring Boot default) — `logback-spring.xml` or `logback.xml` - **SLF4J + Log4j2** — `log4j2-spring.xml` or `log4j2.xml` - **java.util.logging** (flag as legacy) - **Lombok `@Slf4j`** annotation usage If `application.yml` / `application.properties` has `logging.*` keys, note them. ## Step 2 — Identify scope If the user provided a file, focus on that. Otherwise, scan all `*.java` files for logger usage and any logging config files. ## Step 3 — Review checklist ### Logger Declaration ✅ Correct: ```java // Standard private static final Logger log = LoggerFactory.getLogger(MyService.class); // Lombok (preferred when Lombok is already a dependency) @Slf4j public class MyService { ... } ``` ❌ Flag these: - `LoggerFactory.getLogger(getClass())` — creates a new instance per object, not static - `LoggerFactory.getLogger("com.example.MyService")` — string literal, typo-prone - Using `System.out.println` or `System.err.println` for logging - Using `java.util.logging.Logger` when SLF4J is on the classpath ### Log Level Usage | Level | When to use | |-------|-------------| | `ERROR` | Unrecoverable failures, exceptions that bubble up | | `WARN` | Recoverable issues, degraded functionality, deprecat