Skip to content

Document locale handling in the Pattern Layout date pattern converter#4130

Merged
ramanathan1504 merged 8 commits into
2.xfrom
fix-4129-locale-without-timezone
Jun 11, 2026
Merged

Document locale handling in the Pattern Layout date pattern converter#4130
ramanathan1504 merged 8 commits into
2.xfrom
fix-4129-locale-without-timezone

Conversation

@ramanathan1504

Copy link
Copy Markdown
Contributor

Fixes #4129

DatePatternConverter incorrectly interpreted locale-like second arguments (for example de-DE) as timezone IDs when no timezone was provided.
This caused patterns like %d{dd-MMMM-yyyy}{de-DE} to use the JVM default locale instead of the requested locale, producing incorrect localized month names.
This change tightens locale detection so locale tags are correctly recognized in the 2-argument form, while preserving existing behavior for the 3-argument form %d{pattern}{timezone}{locale}.

@ramanathan1504

Copy link
Copy Markdown
Contributor Author

@andrei-ivanov

I think there was a duplicate comment/UI glitch and I may have accidentally removed the thread while cleaning it up. Sorry about that.

but am updated the code as per comments
Screenshot 2026-05-26 at 7 44 47 AM

…dation and add settings for editor configuration
…dation and add settings for editor configuration
@vy vy changed the title Fix DatePatternConverter locale parsing when timezone is omitted Fix DatePatternConverter locale parsing when timezone is omitted May 28, 2026

@vy vy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramanathan1504, pattern-layout.adoc needs to be updated. Would you mind doing that too, please?

@github-project-automation github-project-automation Bot moved this to Changes requested in Log4j pull request tracker May 28, 2026
@ramanathan1504 ramanathan1504 requested a review from vy May 28, 2026 14:27
Comment thread src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc
Comment thread src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc Outdated
Comment thread src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc Outdated
@github-project-automation github-project-automation Bot moved this from Changes requested to Approved in Log4j pull request tracker Jun 11, 2026
@ramanathan1504 ramanathan1504 merged commit dec4351 into 2.x Jun 11, 2026
10 checks passed
@ramanathan1504 ramanathan1504 deleted the fix-4129-locale-without-timezone branch June 11, 2026 18:40
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Log4j pull request tracker Jun 11, 2026
@vy vy changed the title Fix DatePatternConverter locale parsing when timezone is omitted Document locale handling in the Pattern Layout date pattern converter Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Log4J pattern layout inconsistencies when locale is specified

2 participants