SeasonPanPan commented on code in PR #2393:
URL: https://github.com/apache/logging-log4j2/pull/2393#discussion_r1536625743


##########
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) {

Review Comment:
   @vy @ppkarwasz Done. I did not give a warning log for this situation, and I 
added some test cases.



-- 
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

Reply via email to