This is an automated email from the ASF dual-hosted git repository. ramanathan1504 pushed a commit to branch release/2.26.1 in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit bd750d58b7f9879bee9eadcdef330e0cbc28b934 Author: Ramanathan <[email protected]> AuthorDate: Fri Jun 12 00:10:40 2026 +0530 Fix `DatePatternConverter` locale parsing when timezone is omitted (#4130) --- ...129_Fix_DatePatternConverter_locale_without_timezone.xml | 13 +++++++++++++ .../antora/modules/ROOT/pages/manual/pattern-layout.adoc | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/changelog/.2.x.x/LOG4J2-4129_Fix_DatePatternConverter_locale_without_timezone.xml b/src/changelog/.2.x.x/LOG4J2-4129_Fix_DatePatternConverter_locale_without_timezone.xml new file mode 100644 index 0000000000..52238f30fb --- /dev/null +++ b/src/changelog/.2.x.x/LOG4J2-4129_Fix_DatePatternConverter_locale_without_timezone.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="https://logging.apache.org/xml/ns" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://logging.apache.org/xml/ns + https://logging.apache.org/xml/ns/log4j-changelog-0.xsd" + type="fixed"> + <issue id="4129" link="https://github.com/apache/logging-log4j2/issues/4129"/> + <issue id="4130" link="https://github.com/apache/logging-log4j2/pull/4130"/> + <description format="asciidoc"> + Improved documentation for locale handling in the Pattern Layout date pattern converter. </description> +</entry> + diff --git a/src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc b/src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc index 0199783f1d..ebe36a6f52 100644 --- a/src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc +++ b/src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc @@ -389,8 +389,12 @@ Outputs the instant of the log event .link:../javadoc/log4j-core/org/apache/logging/log4j/core/pattern/DatePatternConverter.html[`DatePatternConverter`] specifier grammar [source,text] ---- -d{pattern}[{timezone}] -date{pattern}[{timezone}] +d{pattern} +d{pattern}{timezone} +d{pattern}{timezone}{locale} +date{pattern} +date{pattern}{timezone} +date{pattern}{timezone}{locale} ---- The date conversion specifier may be followed by a set of braces containing a date and time formatting pattern per https://docs.oracle.com/javase/{java-target-version}/docs/api/java/time/format/DateTimeFormatter.html[`DateTimeFormatter`]. @@ -462,6 +466,10 @@ You can also define custom date formats, see following examples: |%d{yyyy-mm-dd'T'HH:mm:ss.SSS'Z'}\{UTC} |2012-11-02T14:34:02.123Z + + +|%d{dd-MMMM-yyyy}\{UTC}\{de-DE} +|02 November 2012 (UTC timezone, German locale) |=== `%d\{UNIX}` outputs the epoch time in seconds, i.e., the difference in seconds between the current time and 1970-01-01 00:00:00 (UTC).
