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

<dependency>
    <groupId>net.dreamlu</groupId>
    <artifactId>mica-log4j2</artifactId>
</dependency>

Gradle

implementation "net.dreamlu:mica-log4j2"

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

logging:
  level:
    org.xxx.xxx: error

Custom Log Configuration

Place each environment’s log configuration under resources/log:

resources
    └── log
        ├── log4j2_dev.xml
        ├── log4j2_ontest.xml
        ├── log4j2_prod.xml
        └── log4j2_test.xml

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaAsynchronousSpring 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

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.