Index: src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java =================================================================== --- src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java (revision 1520419) +++ src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java (working copy) @@ -37,6 +37,8 @@ import org.apache.logging.log4j.core.config.plugins.PluginType; import org.apache.logging.log4j.core.helpers.FileUtils; import org.apache.logging.log4j.core.helpers.Loader; +import org.apache.logging.log4j.core.lookup.Interpolator; +import org.apache.logging.log4j.core.lookup.StrSubstitutor; import org.apache.logging.log4j.status.StatusLogger; import org.apache.logging.log4j.util.PropertiesUtil; @@ -87,6 +89,8 @@ * File name prefix for standard configurations. */ protected static final String DEFAULT_PREFIX = "log4j2"; + + protected final StrSubstitutor substitutor = new StrSubstitutor(new Interpolator()); /** * The name of the classloader URI scheme. @@ -360,26 +364,28 @@ */ @Override public Configuration getConfiguration(final String name, final URI configLocation) { - - if (configLocation == null) { - final String config = PropertiesUtil.getProperties().getStringProperty(CONFIGURATION_FILE_PROPERTY); - if (config != null) { - final ClassLoader loader = this.getClass().getClassLoader(); - final ConfigurationSource source = getInputFromString(config, loader); - if (source != null) { - for (final ConfigurationFactory factory : factories) { - final String[] types = factory.getSupportedTypes(); - if (types != null) { - for (final String type : types) { - if (type.equals("*") || config.endsWith(type)) { - final Configuration c = factory.getConfiguration(source); - if (c != null) { - return c; + if (configLocation == null) { + final String config = this.substitutor.replace(PropertiesUtil.getProperties().getStringProperty(CONFIGURATION_FILE_PROPERTY)); + if(config!=null) { + try { + final ConfigurationSource source = getInputFromURI(new URI(config)); + if (source != null) { + for (final ConfigurationFactory factory : factories) { + final String[] types = factory.getSupportedTypes(); + if (types != null) { + for (final String type : types) { + if (type.equals("*") || config.endsWith(type)) { + final Configuration c = factory.getConfiguration(source); + if (c != null) { + return c; + } } } } } - } + } + } catch(Exception ex) { + ex.printStackTrace(); } } } else {