Replace early SpringProperties logger usage with System.err

Closes gh-26120
This commit is contained in:
Juergen Hoeller 2020-11-19 18:47:31 +01:00
parent c92dccea1b
commit a0544e78ea
1 changed files with 2 additions and 12 deletions

View File

@ -21,9 +21,6 @@ import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.lang.Nullable;
/**
@ -50,8 +47,6 @@ public final class SpringProperties {
private static final String PROPERTIES_RESOURCE_LOCATION = "spring.properties";
private static final Log logger = LogFactory.getLog(SpringProperties.class);
private static final Properties localProperties = new Properties();
@ -61,16 +56,13 @@ public final class SpringProperties {
URL url = (cl != null ? cl.getResource(PROPERTIES_RESOURCE_LOCATION) :
ClassLoader.getSystemResource(PROPERTIES_RESOURCE_LOCATION));
if (url != null) {
logger.debug("Found 'spring.properties' file in local classpath");
try (InputStream is = url.openStream()) {
localProperties.load(is);
}
}
}
catch (IOException ex) {
if (logger.isInfoEnabled()) {
logger.info("Could not load 'spring.properties' file from local classpath: " + ex);
}
System.err.println("Could not load 'spring.properties' file from local classpath: " + ex);
}
}
@ -108,9 +100,7 @@ public final class SpringProperties {
value = System.getProperty(key);
}
catch (Throwable ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not retrieve system property '" + key + "': " + ex);
}
System.err.println("Could not retrieve system property '" + key + "': " + ex);
}
}
return value;