Where to do the logging

Client
  ↓
Filter       → HTTP raw logging
  ↓
Interceptor  → Request-level logging
  ↓
Controller
  ↓
AOP @Around  → Business-level logging
  ↓
Service
  ↓
AOP @AfterThrowing  → Exception logging
  ↓
Repository

SLF4J + Loki Integration

Spring Boot App
   ↓
SLF4J API
   ↓
Logback
   ↓
Log File / Stdout
   ↓
Promtail
   ↓
Loki
   ↓
Grafana
SLF4J Loki
Standard logging API Centralized log storage
Framework-agnostic Cost-efficient
Clean code Easy querying
Structured logging support Native Grafana integration

SLF4J (Simple Logging Facade for Java)

Implementation Usage
Logback Default in Spring Boot
Log4j2 High performance
JUL Built-in Java logging