akka/akka-core
Slf4jLogger formatTimestamp return date/time in ISO 8601 (akkaTimestamp)
开放
#18,079 创建于 2015年7月26日
1 - triagedhelp wantedt:core
仓库指标
- 星标
- (13,277 个星标)
- PR 合并指标
- (平均合并 8天 19小时) (30 天内合并 10 个 PR)
描述
Currently %X{akkaTimestamp} returns only a time portion of the timestamp, e.g.:
00:13:35.140UTC
Absence of the date part is very inconvenient for logging, would be great to have it contain the date, especially return it in the ISO 8601 format, like:
2015-07-26T17:40:08.484Z
This is a very common format these days, especially when readability is essential (as opposite to numeric timestamps), heavily used in JSON, very easy for parsing, also this is a default output format for the java.time.OffsetDateTime toString method.
protected def formatTimestamp(timestamp: Long): String =
OffsetDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneOffset.UTC).toString