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
master
Sam Brannen 13 years ago
parent 98bf01adfb
commit 59e3223c84
  1. 9
      spring-web/src/main/java/org/springframework/web/util/Log4jWebConfigurer.java
  2. 5
      spring-web/src/test/resources/org/springframework/web/util/testlog4j.properties

@ -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);
}

@ -1,2 +1,5 @@
log4j.rootCategory=DEBUG, mock
log4j.appender.mock=org.springframework.web.util.MockLog4jAppender
log4j.appender.mock=org.springframework.web.util.MockLog4jAppender
log4j.logger.org.springframework.mock.web=WARN

Loading…
Cancel
Save