vy commented on code in PR #3789: URL: https://github.com/apache/logging-log4j2/pull/3789#discussion_r2200140855
########## log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/instant/InstantPatternLegacyFormatter.java: ########## @@ -46,7 +46,10 @@ final class InstantPatternLegacyFormatter implements InstantPatternFormatter { private final BiConsumer<StringBuilder, Instant> formatter; InstantPatternLegacyFormatter(final String pattern, final Locale locale, final TimeZone timeZone) { - this.precision = new InstantPatternDynamicFormatter(pattern, locale, timeZone).getPrecision(); + // Replaces 'n' used in legacy patterns with 'S' to obtain the right precision. + // In legacy patterns, the precision of 'n' depends on the pattern length, but + // in `DateTimeFormatter`, it is always nanoseconds. + this.precision = new InstantPatternDynamicFormatter(pattern.replace('n', 'S'), locale, timeZone).getPrecision(); Review Comment: Got it. Created #3816 to address this. I will revert this change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org