ppkarwasz commented on code in PR #3338: URL: https://github.com/apache/logging-log4j2/pull/3338#discussion_r1898981193
########## log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/instant/InstantPatternDynamicFormatter.java: ########## @@ -711,23 +488,114 @@ public void formatTo(final StringBuilder buffer, final Instant instant) { } }; } + + @Override + @Nullable + PatternFormatterFactory tryMerge(PatternFormatterFactory other, ChronoUnit thresholdPrecision) { + // We always merge consecutive static pattern factories + if (other instanceof StaticPatternFormatterFactory) { + final StaticPatternFormatterFactory otherStatic = (StaticPatternFormatterFactory) other; + return new StaticPatternFormatterFactory(this.literal + otherStatic.literal); + } + // We also merge a static pattern factory with a DTF factory + if (other instanceof DateTimeFormatterPatternFormatterFactory) { + final DateTimeFormatterPatternFormatterFactory otherDtf = + (DateTimeFormatterPatternFormatterFactory) other; + return new DateTimeFormatterPatternFormatterFactory( + this.pattern + otherDtf.pattern, otherDtf.precision); + } + return super.tryMerge(other, thresholdPrecision); + } + + static String escapeLiteral(String literal) { Review Comment: Fixed in https://github.com/apache/logging-log4j2/pull/3338/commits/0e8ddb3cfc445f6e6671ce06a732b8d4f7964e91 -- 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