-
Notifications
You must be signed in to change notification settings - Fork 1
io microsphere logging log4j2 LogEventComparator
Type: Class | Module: microsphere-log4j2 | Package: io.microsphere.logging.log4j2 | Since: 1.0.0
Source:
microsphere-log4j2/src/main/java/io/microsphere/logging/log4j2/LogEventComparator.java
The Comparator for LogEvent based on logging time
public class LogEventComparator implements Comparator<LogEvent>Author: Mercy
-
Introduced in:
1.0.0 -
Current Project Version:
0.1.14-SNAPSHOT
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|---|---|
| Java 8 | ✅ Compatible |
| Java 11 | ✅ Compatible |
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
LogEvent event1 = ...; // earlier event
LogEvent event2 = ...; // later event
int result = LogEventComparator.INSTANCE.compare(event1, event2);
// result < 0 means event1 occurred before event2Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-log4j2</artifactId>
<version>${microsphere-logging.version}</version>
</dependency>Tip: Use the BOM (
microsphere-logging-dependencies) for consistent version management. See the Getting Started guide.
import io.microsphere.logging.log4j2.LogEventComparator;| Method | Description |
|---|---|
compare |
Singleton instance |
public int compare(LogEvent o1, LogEvent o2)Singleton instance / public static final LogEventComparator INSTANCE = new LogEventComparator();
private LogEventComparator() { }
/**
Compares two LogEvent instances by their logging timestamp.
Returns a negative integer, zero, or a positive integer if the first event's time
is earlier than, equal to, or later than the second.
`LogEvent event1 = ...; // earlier event LogEvent event2 = ...; // later event int result = LogEventComparator.INSTANCE.compare(event1, event2); // result ## See Also - `LogEvent#getTimeMillis()` --- *This documentation was auto-generated from the source code of [microsphere-logging](https://github.com/microsphere-projects/microsphere-logging).*
java-logging
log4j
log4j2
- DelegatingLayout
- InMemoryAppender
- Log4j2Logger
- Log4j2LoggerFactory
- Log4j2Logging
- Log4j2Utils
- LogEventComparator
- SmartFileAppenderLayout
logback
logging-commons
- DefaultLoggingLevelsResolver
- Logging
- LoggingLevelsResolver
- LoggingMXBeanAdapter
- LoggingMXBeanRegistrar
- LoggingUtils
logging-examples
logging-test