-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
bugIncorrect, unexpected, or unintended behavior of existing codeIncorrect, unexpected, or unintended behavior of existing codelayoutsAffects one or more Layout pluginsAffects one or more Layout pluginswaiting-for-maintainer
Description
Description
The compatibilityOfLegacyPattern test in NamedInstantPatternTest fails when the build is run in an environment with a timezone that has a non-zero minute offset, such as India Standard Time (GMT+05:30).
The test asserts that a legacy date formatter and a new formatter produce identical output. For the ISO8601_OFFSET_DATE_TIME_HH enum value, the legacy formatter produces a timezone offset with minutes (e.g., +0530), while the new formatter produces an offset with only hours (e.g., +05), causing the assertion to fail.
This was discovered while working on PR #3874.
Configuration
- Version:
2.26.0-SNAPSHOT - Operating system:
[macOS 26] - JDK:
[OpenJDK 17.0.5] - Timezone:
GMT+05:30 (e.g., Asia/Kolkata)
Logs
[INFO] Running org.apache.logging.log4j.core.pattern.NamedInstantPatternTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.123 s <<< FAILURE! - in org.apache.logging.log4j.core.pattern.NamedInstantPatternTest
[ERROR] compatibilityOfLegacyPattern(org.apache.logging.log4j.core.pattern.NamedInstantPattern) Time elapsed: 0.1 s <<< FAILURE!
org.opentest4j.AssertionFailedError:
[Compatibility failed for pattern: 'ISO8601_OFFSET_DATE_TIME_HH']
expected: "2025-08-17T12:10:08,887+0530"
but was: "2025-08-17T12:10:08,887+05"
at org.apache.logging.log4j.core.pattern.NamedInstantPatternTest.compatibilityOfLegacyPattern(NamedInstantPatternTest.java:45)
Reproduction
- Set the local machine's system timezone to one with a 30 or 45-minute offset. For example,
Asia/Kolkata(India Standard Time, GMT+05:30). - Check out the
mainbranch of thelogging-log4j2repository. - Run the build with
mvn clean install. - Observe the build failure in the
log4j-core-testmodule, originating fromNamedInstantPatternTest.
Metadata
Metadata
Assignees
Labels
bugIncorrect, unexpected, or unintended behavior of existing codeIncorrect, unexpected, or unintended behavior of existing codelayoutsAffects one or more Layout pluginsAffects one or more Layout pluginswaiting-for-maintainer
Type
Projects
Status
Done