intermediateLogging

Why does log.info("msg={}", value) use a placeholder instead of string concatenation?

The `{}` placeholder defers building the actual string until the logging framework confirms this log level is enabled — string concatenation (`"msg=" + value`) always runs regardless of whether the log line will even be emitted, wasting work on every disabled DEBUG/TRACE call in production.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

Why does log.info("msg={}", value) use a placeholder instead of string concatenation?

Next Step

Continue to Why is logging every request at INFO level a bad default for a production service?← Back to all Spring Boot questions