This is bad and deserves to be raised as error:
logger.info("blah: " + var);
However, this is sometime tolerable:
logger.info(computeToString(var))
Since the log methods which take no arguments short-cut all the format logic and varargs array creation etc - e.g. see org.slf4j.helpers.MessageFormatter#arrayFormat(java.lang.String, java.lang.Object[], java.lang.Throwable)
Note in particular that with this single argument call slf4j does not parse the passed string for {} placeholders
Hence replacing with this has non-trivial performance impact
logger.info("{}", computeToString(var))
Hence it would be useful if (2) could either be captured by a different check, or permitted
This is bad and deserves to be raised as error:
logger.info("blah: " + var);However, this is sometime tolerable:
logger.info(computeToString(var))Since the log methods which take no arguments short-cut all the format logic and varargs array creation etc - e.g. see
org.slf4j.helpers.MessageFormatter#arrayFormat(java.lang.String, java.lang.Object[], java.lang.Throwable)Note in particular that with this single argument call slf4j does not parse the passed string for
{}placeholdersHence replacing with this has non-trivial performance impact
logger.info("{}", computeToString(var))Hence it would be useful if (2) could either be captured by a different check, or permitted