Skip to content

Dev#4

Merged
mercyblitz merged 4 commits into
dev-1.xfrom
dev
Mar 15, 2026
Merged

Dev#4
mercyblitz merged 4 commits into
dev-1.xfrom
dev

Conversation

@mercyblitz
Copy link
Copy Markdown
Contributor

@mercyblitz mercyblitz commented Mar 15, 2026

This pull request introduces a new Log4j2 integration module to the Microsphere logging framework, providing Log4j2 support alongside improvements to documentation, dependency management, and code quality. The most significant changes are the addition of the microsphere-logging-log4j2 module, its supporting utilities and tests, and updates to project configuration files to incorporate this new module.

Log4j2 Integration:

  • Added new module microsphere-logging-log4j2 with its own pom.xml, implementing the Logging interface for Log4j2 via the new Log4j2Logging class. This includes core functionality to get/set logger levels, retrieve logger names, and determine parent loggers. [1] [2]
  • Introduced LoggerUtils utility class in the new module to encapsulate Log4j2-specific logger operations, such as retrieving logger contexts, levels, and setting logger levels.
  • Registered the new Log4j2Logging implementation as a service provider for the Logging interface.

Testing and Configuration:

  • Added comprehensive unit tests for Log4j2Logging and LoggerUtils to ensure correct behavior of logger operations and integration with Log4j2. [1] [2]
  • Added a Log4j2 configuration file (log4j2.xml) for testing, specifying logger levels and appenders.

Build and Dependency Management:

  • Updated microsphere-logging-dependencies/pom.xml to include the new microsphere-logging-log4j2 module as a managed dependency.
  • Updated microsphere-logging-parent/pom.xml to add JUnit BOM and JUnit dependencies for consistent test management across modules.

Documentation:

  • Improved the module overview in README.md to list and describe the new Log4j2 module and clarify the purpose of existing modules.

Code Quality:

  • Refactored test code in microsphere-logging-core to use emptyList() and emptySet() for clarity and consistency. [1] [2] [3]

Replace List.of() and Set.of() with static imports of Collections.emptyList() and emptySet() in ThrowableLogging test. Also remove an extraneous blank line in setLoggerLevel(). These changes clarify intent and can improve compatibility with older Java versions.
Relocate the JUnit BOM and junit dependency to the top of the dependencyManagement section and remove their duplicate entries later in the file. Uses ${junit-jupiter.version} for the BOM and ${junit.version} for junit; this cleans up the POM organization and avoids duplicated dependency declarations.
Reorder and clean up the modules table in the README: simplify wording for the core and test modules, clarify the parent and dependencies entries, and add a new microsphere-logging-logback module for Logback extensions. Also adjust table formatting for clearer presentation.
Introduce a new microsphere-logging-log4j2 module to provide a Log4j2-backed implementation of the Logging SPI. Adds module POM, main implementation (Log4j2Logging), utility class (LoggerUtils), service registration, Log4j2 test config, and unit tests. Also updates the aggregator pom.xml to include the new module and adds the new artifact to microsphere-logging-dependencies/pom.xml.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ Complexity Δ
...a/io/microsphere/logging/log4j2/Log4j2Logging.java 100.00% <100.00%> (ø) 9.00 <9.00> (?)
...o/microsphere/logging/log4j2/util/LoggerUtils.java 100.00% <100.00%> (ø) 14.00 <14.00> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mercyblitz mercyblitz merged commit bd88b86 into dev-1.x Mar 15, 2026
9 checks passed
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Mar 15, 2026

🤖 Augment PR Summary

Summary: Adds Log4j2 support to Microsphere Logging and wires it into the multi-module build.

Changes:

  • Introduces new microsphere-logging-log4j2 module with Log4j2Logging and Log4j2-specific LoggerUtils
  • Registers the Log4j2 implementation via SPI (META-INF/services/io.microsphere.logging.Logging)
  • Adds JUnit Jupiter tests plus a dedicated log4j2.xml test configuration
  • Updates the reactor root pom.xml and the dependencies BOM to include microsphere-logging-log4j2
  • Adjusts a core test implementation to return Collections.emptyList/emptySet instead of List.of/Set.of

Technical Notes: Log4j2 dependencies are declared as optional so consuming apps need to provide Log4j2 on their runtime classpath.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread README.md
microsphere-logging-parent | Parent POM with shared configurations.
microsphere-logging-dependencies | Manages dependency versions across the project.
microsphere-logging-core | Provides the core features for logging.
microsphere-logging-logback | Provides the extensions features for logback.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Modules table doesn’t mention the newly added microsphere-logging-log4j2 module, so the README is now incomplete/misleading; consider adding a row for it.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

<version>${revision}</version>
<packaging>jar</packaging>

<name>Microsphere :: Logging :: Logj4</name>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<name>Microsphere :: Logging :: Logj4</name> looks like a typo and may end up in published Maven metadata; consider aligning it with the actual module (Log4j2).

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

* @see Log4j2Logging
* @since 1.0.0
*/
class Log4j2LoggingTest {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module contains src/test/resources/META-INF/services/io.microsphere.logging.Logging listing io.microsphere.logging.ThrowableLogging, but that class lives under microsphere-logging-core test sources and won’t be on this module’s test/runtime classpath. If any test calls LoggingUtils.loadAll(), this would fail with a ServiceConfigurationError.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant