[logback-dev] [JIRA] Updates for LOGBACK-1735: ILoggingEvent#getInstant should return `Instant.ofEpochMills(getTimeStamp())` instead of null for compatibility
logback developers list
logback-dev at qos.ch
Thu Apr 20 04:12:00 CEST 2023
logback / LOGBACK-1735 [Open]
ILoggingEvent#getInstant should return `Instant.ofEpochMills(getTimeStamp())` instead of null for compatibility
==============================
Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.
View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1735
==============================
Issue created
------------------------------
wreulicke created this issue on 20/Apr/23 4:01
Summary: ILoggingEvent#getInstant should return `Instant.ofEpochMills(getTimeStamp())` instead of null for compatibility
Issue Type: Improvement
Affects Versions: 1.4.8
Assignee: Logback dev list
Components: logback-classic
Created: 20/Apr/23 4:01
Environment:
In my case, the compatibility is broken in the following conditions.
- use logstash-logback-encoder 5.3
- use armeria-logback 1.23.1
- this module is compiled with logback 1.2.x
- use logback 1.4.x
- logback config
```
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<appender name="RCEA" class="com.linecorp.armeria.common.logback.RequestContextExportingAppender">
<appender-ref ref="STDOUT" />
</appender>
<root level="info">
<appender-ref ref="RCEA" />
</root>
</configuration>
```
The logstash-logback-encoder 7.3 calls `getInstant()` when logback 1.3 or higher, [here](https://github.com/logfellow/logstash-logback-encoder/blob/logstash-logback-encoder-7.3/src/main/java/net/logstash/logback/composite/loggingevent/LoggingEventFormattedTimestampJsonProvider.java#L30)
But, armeria-logback has LoggingEventWrapper that extends logback's LoggingEvent.
The LoggingEventWrapper lacks the implementation of `getInstant()` because it depends on logback 1.2 to keep compatibility.
Therefore, logstash-logback-encoder are going to get `null` by default implementation of `getInstant` in ILoggingEvent.
After that, logging is not working by NullPointerException.
Priority: Major
Reporter: wreulicke
Description:
`ILoggingEvent#getInstant()` is introduced in version 1.3.
But, the default implementation returns null.
I think this is the compatibility issue between 1.2.x ~ 1.3.x.
So, to improve compatibility with 1.2 or prior,
propose default implementation returns `Instant.ofEpochMills(getTimeStamp())`.
==============================
This message was sent by Atlassian Jira (v9.6.0#960000-sha1:a3ee8af)
More information about the logback-dev
mailing list