-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Logged is a lightweight Spring Boot library for method‑level logging (AOP). It logs call/return/exception, arguments, return value, and duration; includes redaction/masking; and ships plugins for SLF4J, MDC, and OpenTelemetry. AspectJ weaving is supported for private/self invocation.
Requirements
Java 21, Spring Boot 3.x SLF4J backend (Logback/Log4j2) Optional: AspectJ weaver (for LTW/CTW) and OpenTelemetry API/SDK Index
- Annotation & Defaults
- Logged & Slf4j Defaults and Configuration
- MDC Plugin
- OpenTelemetry Plugin
- Aspect Weaving
- Colors
- Utilities
- Public API
Quick Start
import io.github.darkona.logged.Logged;
@Logged
String greet(String name) { return "Hello, " + name; }
Gradle (Groovy)dependencies {
implementation "io.github.darkona:logged:1.4.0" // replace with your version
}Minimal Configuration (YAML)
logged:
enabled: true
color: true
icons: true
useUtf8: true
maxValueLength: 2048
Templates Cheat SheetClass/method: {c} simple, {C} FQCN, {m} method
Arguments/return: {a}, {rV}, {rC}
Duration: {d} ms
Exception: {ex}, {eM}, {ec}, {em}, file/line {f}:{L}
Icons: {cI} call, {rI} return, {exI} exception, {dI} depth
Depth text: {h}
MDC: {mdc.<key>}
Defaults: {token:default}, escape with {{ }}
Weaving Quickstart (optional)
LTW Add aspectjweaver as runtime dep and start the JVM with -javaagent:/path/aspectjweaver.jar Provide META-INF/aop.xml with and include your packages CTW (Gradle example) Use FreeFair AspectJ post‑compile weaving and add this library to the aspect configuration Keep src/main/resources/META-INF/aop.xml on the classpath Security & Privacy
Prefer maskArgValues, maskAtPos, maskTypes, maskPatterns, and maskReturn where sensitive data may appear Set logged.maxValueLength conservatively to cap payload size in logs Performance
Disable what you don’t need per method: onCall=false, args=false, returnValue=NONE Use global threshold promotion to flag slow calls without verbose templates Explore More