SeasonPanPan commented on code in PR #2393: URL: https://github.com/apache/logging-log4j2/pull/2393#discussion_r1535270832
########## log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java: ########## @@ -240,12 +244,14 @@ static void formatMessage( return; } - // Fail if there are insufficient arguments - if (analysis.placeholderCount > args.length) { + // check if there are insufficient arguments that do not include Throwable arg + final int realArgCount = args.length; + final int noThrowableArgCount = realArgCount - ((args[realArgCount - 1] instanceof Throwable) ? 1 : 0); + if (analysis.placeholderCount != noThrowableArgCount) { final String message = String.format( "found %d argument placeholders, but provided %d for pattern `%s`", - analysis.placeholderCount, args.length, pattern); - throw new IllegalArgumentException(message); + analysis.placeholderCount, realArgCount, pattern); + STATUS_LOGGER.warn(message); Review Comment: Yes, yours is good example. -- 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