diff --git a/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java b/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java index 3764890430..550a4a079c 100644 --- a/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java +++ b/spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java @@ -122,11 +122,14 @@ public abstract class Log4jWebConfigurer { if (location != null) { // Perform actual log4j initialization; else rely on log4j's default initialization. try { - // Return a URL (e.g. "classpath:" or "file:") as-is; - // consider a plain file path as relative to the web application root directory. + // Resolve system property placeholders before potentially + // resolving a real path. location = SystemPropertyUtils.resolvePlaceholders(location); + + // Leave a URL (e.g. "classpath:" or "file:") as-is. if (!ResourceUtils.isUrl(location)) { - // Resolve system property placeholders before resolving real path. + // Consider a plain file path as relative to the web + // application root directory. location = WebUtils.getRealPath(servletContext, location); } diff --git a/spring-web/src/test/resources/org/springframework/web/util/testlog4j.properties b/spring-web/src/test/resources/org/springframework/web/util/testlog4j.properties index edd07d0de4..1121ae21b3 100644 --- a/spring-web/src/test/resources/org/springframework/web/util/testlog4j.properties +++ b/spring-web/src/test/resources/org/springframework/web/util/testlog4j.properties @@ -1,2 +1,5 @@ log4j.rootCategory=DEBUG, mock -log4j.appender.mock=org.springframework.web.util.MockLog4jAppender \ No newline at end of file + +log4j.appender.mock=org.springframework.web.util.MockLog4jAppender + +log4j.logger.org.springframework.mock.web=WARN