Hi Volkan,

On Mon, 14 Oct 2024 at 21:30, Volkan Yazıcı <vol...@yazi.ci.invalid> wrote:
> Hence, I propose switching all layouts to use `DateTimeFormatter`, unless
> the `log4j.time.legacyFormatterEnabled` property is provided. Objections?

Can you upgrade `FixedDateFormat` to use DTF as date formatter and use
it whenever it is applicable?
The bug #2943 can IMHO opinion be fixed by changing the way
`FixedDateFormat` caches the date part of the timestamp:

* currently the cache consists of the "date string" and up to 25
offsets that associate each hour with the offset to UTC. The latter
part is very prone to errors and will fail if a country decides to
switch to DST at 2:30 am.
* you can limit the cache to the "date string" and update the cache at
the end of the day or the start of DST, whichever occurs first. Twice
a year we will update the cache twice a day (at midnight and 2:00 am).

If `FixedDateFormat` is fixed, we can use:

* `FixedDateFormat` and `DateTimeFormatter` by default,
* `FastDateFormat` if users enable the
`log4j2.timeLegacyFormatterEnabled` (please use the post-2.10
normalized form).

Piotr

[1] https://github.com/apache/logging-log4j2/issues/2943

Reply via email to