Browse Source

PropertySourcesPropertyResolver does not log retrieved value by default

Issue: SPR-14709
(cherry picked from commit fbe7ddb)
pull/1172/head
Juergen Hoeller 8 years ago
parent
commit
782c99dfaf
  1. 10
      spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java

10
spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java vendored

@ -93,8 +93,10 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { @@ -93,8 +93,10 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
/**
* Log the given key as found in the given {@link PropertySource}, resulting in
* the given value.
* <p>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.
* <p>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
@ -102,8 +104,8 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { @@ -102,8 +104,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()));
}
}

Loading…
Cancel
Save