From 59e3223c849fd04c1415f5ddd9bfb9acb9a17b60 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 17 May 2012 18:05:38 +0200 Subject: [PATCH] Polish recent changes to Log4jWebConfigurer Reordered inline comments so that they now apply to current state of the code. Added logger entry in testlog4j.properties to avoid console warning. Issue: SPR-9417 --- .../org/springframework/web/util/Log4jWebConfigurer.java | 9 ++++++--- .../org/springframework/web/util/testlog4j.properties | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) 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