DEV.co
Open-Source Observability · qqxx6661

log-record

log-record is a Spring Boot annotation-based library for recording operation logs without intruding into business logic. It uses SpEL expressions to extract data from method parameters, supports custom functions and context, entity diffing, and can pipe logs to RabbitMQ, RocketMQ, or Spring Cloud Stream.

Source: GitHub — github.com/qqxx6661/log-record
1.1k
GitHub stars
195
Forks
Java
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryqqxx6661/log-record
Ownerqqxx6661
Primary languageJava
LicenseApache-2.0 — OSI-approved
Stars1.1k
Forks195
Open issues11
Latest releasev1.7.1 (2025-07-26)
Last updated2025-07-26
Sourcehttps://github.com/qqxx6661/log-record

What log-record is

Provides aspect-oriented logging via @OperationLog annotation with SpEL expression evaluation, custom function registration, conditional logging, multi-message-queue backend support (RabbitMQ, RocketMQ, Spring Cloud Stream), entity Diff comparison, and non-invasive context binding through LogRecordContext.

Quickstart

Get the log-record source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/qqxx6661/log-record.gitcd log-record# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Operation Audit Trail in Enterprise Apps

Track user actions (create, update, delete) with before/after entity state diffs and operator context—critical for compliance, financial systems, and CRM platforms. Clean annotation syntax keeps business code readable.

Multi-Tenant SaaS Platforms

Log tenant-specific operations with automatic bizId/bizType extraction via SpEL. Route logs to message queues for real-time analytics dashboards or off-cluster processing without latency impact on request handling.

Order/Payment Processing Systems

Document state transitions (e.g., 'order moved from pending to shipped by admin') with dynamic template rendering. Support custom functions to query immutable historical data and auto-diff order objects.

Implementation considerations

  • SpEL expressions are evaluated at runtime; malformed expressions will fail gracefully but must be tested—no compile-time validation. Use static strings where possible to reduce surface area.
  • Custom functions must be registered before aspect initialization; function dependencies (e.g., database queries) must handle their own transaction/connection lifecycle to avoid deadlocks.
  • LogRecordContext uses ThreadLocal storage; in async/reactive code paths (CompletableFuture, WebFlux), context may not propagate—manually pass context or wrap async calls.
  • Entity Diff comparison is reflection-based; large object graphs or circular references can cause performance degradation or stack overflow. Test with your actual entity sizes.
  • Message queue integration (RabbitMQ, RocketMQ) requires external infrastructure; connection failures are handled via retry SPI, but production deployments need monitoring and dead-letter queues.

When to avoid it — and what to weigh

  • Require Real-Time Guaranteed Delivery — Async logging via thread pool; if a log write fails, retry logic and SPI fallback exist, but messages can be lost if infrastructure crashes. Not suitable for financial transaction records requiring 100% durability guarantees.
  • Simple Logging Without Dynamic Context — If you only need static log statements (e.g., 'user logged in'), standard SLF4J is simpler and has less runtime overhead. SpEL evaluation and context binding add latency for trivial use cases.
  • Lightweight Microservices or Embedded Systems — Introduces Spring Boot dependency, aspect weaving, and SpEL runtime evaluation. Not ideal for projects minimizing framework overhead or running on resource-constrained environments.
  • High-Volume Log Ingestion Without Batching — Library sends logs individually to message queues; no built-in batching. For extremely high-frequency operations, consider pre-aggregation or batch collection layers.

License & commercial use

Licensed under Apache License 2.0, a permissive OSI-approved license allowing commercial use, modification, and distribution with attribution and liability limitations.

Apache-2.0 is a well-established permissive license compatible with most commercial products. No proprietary restrictions on using log-record in closed-source or for-profit applications. Legal review recommended for mission-critical deployments to confirm compliance with your liability and indemnification policies.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

SpEL expressions parsed at runtime—only allow trusted annotation values; do not dynamically build expressions from user input to prevent SpEL injection. LogRecordContext uses ThreadLocal; ensure no sensitive context (passwords, tokens) is logged. Async log processing may expose logs in flight; encrypt message queue channels if logging PII. No explicit mention of secret redaction or field masking.

Alternatives to consider

mzt-biz-log (Meituan original)

Original inspiration source cited in README; if you require Meituan's exact implementation or ongoing Meituan-specific support, use that. log-record is a community reimplementation with additional features.

Spring AOP + Custom Aspect with SLF4J

Manual but minimal-dependency alternative if SpEL and context binding are overkill. Lower learning curve, no message queue coupling, but requires writing boilerplate aspect and context handling code.

Apache Commons Audit / AuditJ

Dedicated audit logging libraries with built-in compliance features (e.g., tamper detection). Heavier but stronger guarantees for regulated industries if log-record's async-first design is insufficient.

Software development agency

Build on log-record with DEV.co software developers

Add one dependency and start logging operations with clean annotations. Connect to your message queue, database, or analytics platform in minutes. No business code changes required.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

log-record FAQ

Does log-record block my business logic if the logger fails?
No. The aspect is designed to catch exceptions from logging and not propagate them. Failed log writes use retry SPI and fallback handlers. Business method execution completes regardless of logging success.
Can I use log-record with non-Spring Boot projects?
Unlikely. The library is tightly coupled to Spring Boot Starter auto-configuration. Manual Spring AOP setup may be possible but is unsupported and complex.
How do I log PII safely?
Not directly addressed in docs. Implement custom masking in your IOperationLogGetService.createLog() method or use custom SpEL functions to redact sensitive fields before logging.
What happens if my RabbitMQ broker is down?
Retry logic (configurable via SPI) will attempt to resend; if exhausted, a fallback SPI is invoked. Logs may be lost if fallback is not implemented. Implement persistent fallback (e.g., file queue) for critical operations.

Work with a software development agency

Adopting log-record is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source observability software in production.

Integrate Audit Logging into Your Spring Boot App

Add one dependency and start logging operations with clean annotations. Connect to your message queue, database, or analytics platform in minutes. No business code changes required.