Backend Development 3 min read

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.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
Boost Java Spring Boot Performance with Mica-Log4j2’s Asynchronous Logging

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>&lt;dependency&gt;
    &lt;groupId&gt;net.dreamlu&lt;/groupId&gt;
    &lt;artifactId&gt;mica-log4j2&lt;/artifactId&gt;
&lt;/dependency&gt;
</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.log

and

error.log

respectively.

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.

JavaConfigurationasynchronousloggingSpring Bootlog4j2Mica
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.