akka/akka-core
View on GitHubSlf4jLogger formatTimestamp return date/time in ISO 8601 (akkaTimestamp)
Open
#18,079 opened on Jul 26, 2015
1 - triagedhelp wantedt:core
Description
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