ecs-logging-java
ecs-logging-java copied to clipboard
Add time zone support
Use the JVM's default timezone by default and let users configure a different time zone.
hope can use timezone soon.
Would you be interested to implement this feature?
hi, can i work on this issue?
You can but in contrast to what the labels say, it's probably not a good first issue. I've tried it the other day and it's more tricky than I have though.
The reason is the requirement of not allocating objects during serialization to reduce GC pressure on the application. It means that we can't just use SimpleDataFormat
or any date format that comes with the JDK. I've implemented TimestampSerializer
but adding time zone support for it is quite hard. The class works under the premise that It only has to invoke SimpleDataFormat
for to format the year, month and date. The result can be cached until the next day. The hour:minute:second.microsecond part of the timestamp is efficiently computed with modulo operations.
The issue is that the UTC offset can change during a day (on the day daylight savings time changes). Thus, we can't cache the UTC offset.
I don't have a good idea about how to proceed. Maybe we could use an adapted version of https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/FastDateFormat.html that accepts StringBuilder
instead of StringBuffer
. But I have not compared the performance to the current TimestampSerializer
yet. So I guess that would be the first step.
Thanks for your suggestion and explanations, so i look for another issue.
hello, how to resolve it?
@felixbarny
As outlined, this is significant work, so not currently priortized