In the following example, the first error leads to the failure:
WARN StatusConsoleListener io.github.oshai.kotlinlogging.slf4j.internal.LocationAwareKLogger caught java.lang.IllegalArgumentException logging ReusableParameterizedMessage: Hey this fails {}
java.lang.IllegalArgumentException: found 1 argument placeholders, but provided 0 for pattern `Hey this fails {}`
at org.apache.logging.log4j.message.ParameterFormatter.formatMessage(ParameterFormatter.java:238)
logger.atInfo {
message = "Hey this fails {}"
payload = mapOf(
"first" to "second"
)
}
logger.atInfo {
message = "Hey this doesn't fail {}"
}
Configuration:
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("io.github.oshai:kotlin-logging-jvm:6.0.3")
implementation("org.springframework.boot:spring-boot-starter-actuator")
It doesn't seem like the issue happens with Spring Boots default logger spring-boot-starter-logging (vs log4j2).
I am aware this is an error arising from log4j but I'm wondering if there is something we can do for these methods to always avoid parameterized messaging. As far as I understand, we couldn't use atInfo to parameterize messages anyways.
Example can be found here. Let me know if there's a better way to provide examples.
In the following example, the first error leads to the failure:
logger.atInfo { message = "Hey this fails {}" payload = mapOf( "first" to "second" ) } logger.atInfo { message = "Hey this doesn't fail {}" }Configuration:
It doesn't seem like the issue happens with Spring Boots default logger
spring-boot-starter-logging(vs log4j2).I am aware this is an error arising from log4j but I'm wondering if there is something we can do for these methods to always avoid parameterized messaging. As far as I understand, we couldn't use
atInfoto parameterize messages anyways.Example can be found here. Let me know if there's a better way to provide examples.