Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ The framework is organized into several key modules:
----------------------------------|-------------------------------------------------------------------------
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-jdk | Provides the extensions features for Java Logging.
microsphere-logging-logback | Provides the extensions features for logback.
microsphere-logging-log4j2 | Provides the extensions features for log4j2.
microsphere-logging-commons | Provides the commons features for logging.
microsphere-logging-test | Provides the extensions of JUnit4 or JUnit Jupiter for logging testing.
microsphere-java-logging | Provides the extensions features for Java Logging.
microsphere-logback | Provides the extensions features for logback.
microsphere-log4j2 | Provides the extensions features for log4j2.

## Getting Started

Expand Down Expand Up @@ -60,7 +60,7 @@ Then add the specific modules you need:
<!-- Logging Core -->
Comment thread
mercyblitz marked this conversation as resolved.
Outdated
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
</dependency>
</dependencies>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-jdk</artifactId>
<artifactId>microsphere-java-logging</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>

<name>Microsphere :: Logging :: JDK</name>
<description>Microsphere Logging JDK</description>
<name>Microsphere :: Logging :: Java Logging</name>
<description>Microsphere Java Logging</description>

<dependencies>

<!-- Microsphere Logging -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
* @see LoggingMXBean
* @since 1.0.0
*/
public class JDKLogging implements Logging {
public class JavaLogging implements Logging {

/**
* The priority of {@link JDKLogging}
* The priority of {@link JavaLogging}
*/
public static final int PRIORITY = NORMAL_PRIORITY + 10;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.microsphere.logging.jdk.JavaLogging
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@
import java.util.Set;

import static io.microsphere.collection.Sets.ofSet;
import static io.microsphere.logging.jdk.JDKLogging.ALL_LEVELS;
import static io.microsphere.logging.jdk.JDKLogging.PRIORITY;
import static io.microsphere.logging.jdk.JDKLogging.loggingMXBean;
import static io.microsphere.logging.jdk.JavaLogging.ALL_LEVELS;
import static io.microsphere.logging.jdk.JavaLogging.PRIORITY;
import static io.microsphere.logging.jdk.JavaLogging.loggingMXBean;
import static io.microsphere.util.ServiceLoaderUtils.loadFirstService;
import static io.microsphere.util.StringUtils.isBlank;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* {@link JDKLogging} Test
* {@link JavaLogging} Test
*
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
* @see JDKLogging
* @see JavaLogging
* @since 1.0.0
*/
class JDKLoggingTest {
class JavaLoggingTest {

/**
* @see java.util.logging.Level
*/
public static final Set<String> JAVA_LOGGING_LEVELS = ofSet("OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL");

private JDKLogging JDKLogging;
private JavaLogging JavaLogging;

@BeforeEach
void setUp() {
this.JDKLogging = (JDKLogging) loadFirstService(Logging.class);
this.JavaLogging = (JavaLogging) loadFirstService(Logging.class);
}

@Test
Expand All @@ -62,51 +62,51 @@ void testConstants() {

@Test
void testGetLoggerNames() {
assertEquals(this.JDKLogging.getLoggerNames(), loggingMXBean.getLoggerNames());
assertEquals(this.JavaLogging.getLoggerNames(), loggingMXBean.getLoggerNames());
}

@Test
void testGetSupportedLoggingLevels() {
assertEquals(JAVA_LOGGING_LEVELS, this.JDKLogging.getSupportedLoggingLevels());
assertEquals(JAVA_LOGGING_LEVELS, this.JavaLogging.getSupportedLoggingLevels());
}

@Test
void testGetLoggerLevel() {
List<String> loggerNames = this.JDKLogging.getLoggerNames();
loggerNames.forEach(loggerName -> assertEquals(this.JDKLogging.getLoggerLevel(loggerName), loggingMXBean.getLoggerLevel(loggerName)));
List<String> loggerNames = this.JavaLogging.getLoggerNames();
loggerNames.forEach(loggerName -> assertEquals(this.JavaLogging.getLoggerLevel(loggerName), loggingMXBean.getLoggerLevel(loggerName)));
}

@Test
void testSetLoggerLevel() {
List<String> loggerNames = this.JDKLogging.getLoggerNames();
List<String> loggerNames = this.JavaLogging.getLoggerNames();
for (String loggerName : loggerNames) {
String level = this.JDKLogging.getLoggerLevel(loggerName);
String level = this.JavaLogging.getLoggerLevel(loggerName);
if (isBlank(level)) {
continue;
}
for (String newLevel : ALL_LEVELS) {
this.JDKLogging.setLoggerLevel(loggerName, newLevel);
assertEquals(newLevel, this.JDKLogging.getLoggerLevel(loggerName));
this.JavaLogging.setLoggerLevel(loggerName, newLevel);
assertEquals(newLevel, this.JavaLogging.getLoggerLevel(loggerName));
}
this.JDKLogging.setLoggerLevel(loggerName, level);
this.JavaLogging.setLoggerLevel(loggerName, level);
}
}

@Test
void testGetParentLoggerName() {
List<String> loggerNames = this.JDKLogging.getLoggerNames();
List<String> loggerNames = this.JavaLogging.getLoggerNames();
for (String loggerName : loggerNames) {
assertEquals(this.JDKLogging.getParentLoggerName(loggerName), loggingMXBean.getParentLoggerName(loggerName));
assertEquals(this.JavaLogging.getParentLoggerName(loggerName), loggingMXBean.getParentLoggerName(loggerName));
}
}

@Test
void testGetName() {
assertEquals("Java Logging", this.JDKLogging.getName());
assertEquals("Java Logging", this.JavaLogging.getName());
}

@Test
void testGetPriority() {
assertEquals(PRIORITY, this.JDKLogging.getPriority());
assertEquals(PRIORITY, this.JavaLogging.getPriority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-log4j2</artifactId>
<artifactId>microsphere-log4j2</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>

Expand All @@ -23,7 +23,7 @@
<!-- Microsphere Logging -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-logback</artifactId>
<artifactId>microsphere-logback</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>

Expand All @@ -23,7 +23,7 @@
<!-- Microsphere Logging -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>

<name>Microsphere :: Logging :: Core</name>
<description>Microsphere Logging Core</description>
<name>Microsphere :: Logging :: Commons</name>
<description>Microsphere Logging Commons</description>

<dependencies>

Expand Down
8 changes: 4 additions & 4 deletions microsphere-logging-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@

<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-jdk</artifactId>
<artifactId>microsphere-java-logging</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-logback</artifactId>
<artifactId>microsphere-logback</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-log4j2</artifactId>
<artifactId>microsphere-log4j2</artifactId>
<version>${revision}</version>
</dependency>

Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions microsphere-logging-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Microsphere Logging -->
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-core</artifactId>
<artifactId>microsphere-logging-commons</artifactId>
<version>${revision}</version>
</dependency>

Expand Down Expand Up @@ -77,7 +77,7 @@

<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-logging-logback</artifactId>
<artifactId>microsphere-logback</artifactId>
<version>${revision}</version>
<scope>test</scope>
</dependency>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
<modules>
<module>microsphere-logging-parent</module>
<module>microsphere-logging-dependencies</module>
<module>microsphere-logging-core</module>
<module>microsphere-logging-jdk</module>
<module>microsphere-logging-logback</module>
<module>microsphere-logging-log4j2</module>
<module>microsphere-logging-commons</module>
<module>microsphere-java-logging</module>
<module>microsphere-logback</module>
<module>microsphere-log4j2</module>
<module>microsphere-logging-test</module>
</modules>

Expand Down
Loading