title: Logback variable substitution could not locate property file on the classpath
body: <p>I really like Logback's support to log into a DB. However, I'm having trouble using Logback's variable substitution feature, more specifically, from a property file on the classpath.</p>
  
  <p>My reference: <a href="http://logback.qos.ch/manual/configuration.html#variableSubstitution" rel="nofollow noreferrer">http://logback.qos.ch/manual/configuration.html#variableSubstitution</a></p>
  
  <p>So I have a multi-module Maven project. In my web module (which generates a .war file), I have my Logback conf files in the following dir:</p>
  
  <pre><code>src/main/resources
  - logback.xml
  - local.properties
  - dev.properties
  </code></pre>
  
  <p>My logback.xml file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  
      &lt;property file="${env}.properties"/&gt;
  
      &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{HH:mm:ss.SSS} [%X{messageId}] %-5level %logger{0} - %msg%n
              &lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;appender name="DB" class="ch.qos.logback.classic.db.DBAppender"&gt;
          &lt;connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource"&gt;
              &lt;dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt;
                  &lt;driverClass&gt;${logback.db.driverClassName}&lt;/driverClass&gt;
                  &lt;jdbcUrl&gt;${logback.db.url}&lt;/jdbcUrl&gt;
                  &lt;user&gt;${logback.db.user}&lt;/user&gt;
                  &lt;password&gt;${logback.db.password}&lt;/password&gt;
              &lt;/dataSource&gt;
          &lt;/connectionSource&gt;
      &lt;/appender&gt;
  
      &lt;root level="debug"&gt;
          &lt;appender-ref ref="DB" /&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>So when I start my Tomcat server, I would pass in the ${env} like this:</p>
  
  <pre><code>-Denv=local
  </code></pre>
  
  <p>However, I got the following error when I brought up the server:</p>
  
  <pre><code>17:45:22,782  WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DriverManagerDataSource:107 - Could not load driverClass logback.db.driverClassName_IS_UNDEFINED
  java.lang.ClassNotFoundException: logback.db.driverClassName_IS_UNDEFINED
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
  </code></pre>
  
  <p>It looks like Logback Joran was having trouble locating the property file. </p>
  
  <p>Can anyone let me know what I did wrong?</p>