Boost Java Spring Boot Performance with Mica-Log4j2’s Asynchronous Logging
This guide explains how Mica-Log4j2 provides environment‑specific log configurations, high‑throughput asynchronous logging via Disruptor, replaces System.out/err in non‑dev modes, and shows Maven/Gradle dependencies, system settings, custom log levels, file structures, and open‑source resources for Spring Boot applications.
Feature Introduction
Separate log configurations for environments dev, test, ontest, prod.
High‑performance asynchronous logging based on Disruptor.
In non‑dev environments, replace System.out and System.err with log calls to improve performance.
Dependency Coordinates
Maven
<code><dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-log4j2</artifactId>
</dependency>
</code>Gradle
<code>implementation "net.dreamlu:mica-log4j2"</code>System Configuration
Configuration item LOGGING_PATH defaults to the directory next to the JAR; it specifies the log directory and reads the system environment variable.
Rules
Logs are written to
info.logand
error.logrespectively.
Note: In Spring Boot Admin monitoring, the default displayed file is
info.log.
Custom Log Level
<code>logging:
level:
org.xxx.xxx: error
</code>Custom Log Configuration
Place each environment’s log configuration under
resources/log:
<code>resources
└── log
├── log4j2_dev.xml
├── log4j2_ontest.xml
├── log4j2_prod.xml
└── log4j2_test.xml
</code>Open Source Recommendations
Spring Boot microservice toolkit – Mica: https://gitee.com/596392912/mica
pig– powerful microservice framework: https://gitee.com/log4j/pig
SpringBlade– complete production solution: https://gitee.com/smallc/SpringBlade
Join the “如梦技术” Spring QQ group 479710041 for more information.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.