Inspectopedia Help

Number of placeholders does not match number of arguments in logging call

Reports SLF4J, Log4j2 and akka.event.LoggingAdapter logging calls, such as"{}: {}", key) where the number of {} placeholders in the logger message doesn't match the number of other arguments to the logging call.

Use the inspection option to specify which implementation SLF4J uses. If Check automatically is chosen, then org.apache.logging.slf4j.Log4jLogger is searched in the classpath. If this file is founded or Yes is chosen, then cases, when the last parameter with an exception type has a placeholder, will not be reported for SLFJ4 API. For example:

// will not be reported log.error("For id {}: {}", id, new RuntimeException());

This option works only for SLF4J.

Inspection options




SLF4J uses Log4j 2 as implementation


Check automatically

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023