From fbe7ddb6403382554ab75239834ede534d06b6af Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 13 Sep 2016 23:43:52 +0200 Subject: [PATCH] PropertySourcesPropertyResolver does not log retrieved value by default Issue: SPR-14709 --- .../core/env/PropertySourcesPropertyResolver.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java index 3246204328f..1a92673de2a 100644 --- a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java +++ b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java @@ -137,8 +137,10 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { /** * Log the given key as found in the given {@link PropertySource}, resulting in * the given value. - *

The default implementation writes a debug log message, including the value. - * Subclasses may override this to change the log level and/or the log message. + *

The default implementation writes a debug log message with key and source. + * As of 4.3.3, this does not log the value anymore in order to avoid accidental + * logging of sensitive settings. Subclasses may override this method to change + * the log level and/or log message, including the property's value if desired. * @param key the key found * @param propertySource the {@code PropertySource} that the key has been found in * @param value the corresponding value @@ -146,8 +148,8 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { */ protected void logKeyFound(String key, PropertySource propertySource, Object value) { if (logger.isDebugEnabled()) { - logger.debug(String.format("Found key '%s' in [%s] with type [%s] and value '%s'", - key, propertySource.getName(), value.getClass().getSimpleName(), value)); + logger.debug(String.format("Found key '%s' in [%s] with type [%s]", + key, propertySource.getName(), value.getClass().getSimpleName())); } }