Skip to content

Broken timestamp since Log4J 2.25 #3792

@fabian-braun

Description

@fabian-braun

Description

We sometimes encounter broken timestamp fields in our logs since we upgraded to the latest Log4J version which has been released a few days ago.

The logged timestamp is cut off and cannot be parsed by our ElasticSearch backend. For example it looks like 2025-06-28T10:20: (note how seconds, etc are missing)

I suspect the culprit is your switch to Java’s standard DateTimeFormatter in the latest release

Image

Configuration

Version: 2.25.0

Operating system: Linux, 6.8.0-1024-aws

JDK: amazoncorretto:21-al2023

Reproduction

We cannot reproduce the behavior in a unit tests. It only happens roughly 20 times per day, out of more than 10k total log messages

We are using JsonTemplateLayout with the following config (excerpt):

{
  "@timestamp": {
    "$resolver": "timestamp",
    "pattern": {
      "format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
      "timeZone": "UTC"
    }
  },

Metadata

Metadata

Assignees

Labels

bugIncorrect, unexpected, or unintended behavior of existing codelayoutsAffects one or more Layout plugins

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions