Affects: Spring Framework version: 5.2.8
org.springframework.kafka.core.KafkaTemplate
is using the org.springframework.core.log.LogAccessor
Supplier
-enabled logging methods (trace etc.). Unfortunately, LogAccessor
does not check the currently enabled log level, so it always creates an additional SupplierMessage
object even of the data never gets logged. In addition, in case the standard JCL -> SLF4J bridge (jcl-over-slf4j.jar
) of the SLF4J project is being used instead of spring-jcl
, the SLF4JLog class of this bridge unfortunately also converts the object to a string unconditionally, probably as it assumes the log level has been checked before, which slows down processing dramatically.
Assuming that the LogAccessor
Supplier
-enabled logging methods are intended to be called without log level check before, wouldn't it be better to at least check the log level in LogAccessor
in these methods, to avoid creating objects / converting the objects to String unnecessarily?