Fix property replacement bug in Log4jWebConfigurer
Previously, if the resolution of a ${...} placeholder resulted in a
valid URL for the location of a log4j properties/XML file, the URL
would ultimately be malformed by an unnecessary call to to
WebUtils#getRealPath.
The implementation of Log4jWebConfigurer#initLogging now eagerly
attempts SystemPropertyUtils#resolvePlaceholders before checking to see
if the location is a valid URL, and bypassing the call to
WebUtils#getRealPath if so.
Issue: SPR-9417
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -124,9 +124,9 @@ public abstract class Log4jWebConfigurer {
|
||||
try {
|
||||
// Return a URL (e.g. "classpath:" or "file:") as-is;
|
||||
// consider a plain file path as relative to the web application root directory.
|
||||
location = SystemPropertyUtils.resolvePlaceholders(location);
|
||||
if (!ResourceUtils.isUrl(location)) {
|
||||
// Resolve system property placeholders before resolving real path.
|
||||
location = SystemPropertyUtils.resolvePlaceholders(location);
|
||||
location = WebUtils.getRealPath(servletContext, location);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user