Dev#5
Conversation
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.
🤖 Augment PR SummarySummary: This PR introduces Log4j2 support to Microsphere Logging by adding a dedicated integration module. Changes:
Technical Notes: The integration relies on Log4j2 core APIs (logger context + level control) and is discovered through Java SPI at runtime. 🤖 Was this summary useful? React with 👍 or 👎 |
| 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. |
There was a problem hiding this comment.
| <version>${revision}</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <name>Microsphere :: Logging :: Logj4</name> |
| <dependency> | ||
| <groupId>org.apache.logging.log4j</groupId> | ||
| <artifactId>log4j-api</artifactId> | ||
| <optional>true</optional> |
There was a problem hiding this comment.
Since this module registers a Logging provider via SPI, making log4j-api/log4j-core optional can cause ServiceLoader/ServiceConfigurationError at runtime if a consumer includes this module but doesn’t also include Log4j2 on the classpath.
Severity: medium
Other Locations
microsphere-logging-log4j2/pom.xml:53
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| * @see Log4j2Logging | ||
| * @since 1.0.0 | ||
| */ | ||
| class Log4j2LoggingTest { |
There was a problem hiding this comment.
Note: microsphere-logging-log4j2/src/test/resources/META-INF/services/io.microsphere.logging.Logging currently lists io.microsphere.logging.ThrowableLogging, which is a test-only class from microsphere-logging-core and isn’t on this module’s test classpath; any call to LoggingUtils.loadAll() during these tests would fail with a ServiceConfigurationError.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
This pull request introduces Log4j2 support to the Microsphere Logging framework, along with related documentation, dependency, and test updates. The changes add a new
microsphere-logging-log4j2module, implement the necessary integration classes, update the project structure and dependencies, and provide comprehensive tests for the new functionality.Log4j2 Integration:
microsphere-logging-log4j2, including its Maven POM with dependencies for Log4j2, core logging, and testing libraries.Log4j2Logging, aLogginginterface implementation for Log4j2, providing methods for logger management and level control.LoggerUtilsutility class for working with Log4j2 loggers, including methods to get/set logger levels and retrieve logger context.Testing and Configuration:
Log4j2LoggingandLoggerUtilsto verify logger name retrieval, level support, parent logger resolution, and level setting. [1] [2]log4j2.xmlconfiguration for testing purposes.Project Structure and Dependency Updates:
README.mdto document the new Log4j2 module and clarify module purposes.microsphere-logging-dependencies/pom.xml.Code Quality Improvements:
ThrowableLoggingto useemptyList()andemptySet()for clarity and consistency. [1] [2] [3]These changes collectively enable Log4j2 support in the Microsphere Logging framework and improve overall project structure and testability.