https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java#L1150

        private void logBody(Object body, @Nullable MediaType mediaType, HttpMessageConverter<?> converter) {
            if (logger.isDebugEnabled()) {
                if (mediaType != null) {
                    logger.debug("Writing [" + body + "] as \"" + mediaType + "\"");
                }
                else {
                    logger.debug("Writing [" + body + "] with " + converter.getClass().getName());
                }
            }
        }
    }

How we do support masking the sensitive information from the body?

Thanks, Amit

Comment From: bclozel

You'll need to configure the logger with a log level above DEBUG; DEBUG level is not advised in production.

Comment From: amitlpande

I understand DEBUG level is not advised in production. However, if we ever have to debug any issue, debugging will be turned on. In such case, we don't want to log any sensitive information.