title: log4j2.xml property substitution ${ } not working in WebLogic 12.2.1
body: <p>I have JAX-RS web service running on WebLogic 12.2.1. The web service uses log4j2 for logging, and so far it is able to log to the log file as specified in log4j2.xml, as shown here:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="DEBUG"&gt;
      &lt;Properties&gt;
          &lt;Property name="log-path"&gt;E:/MLM/MLMDomain/servers/MLMAppSrv01/logs&lt;/Property&gt;
      &lt;/Properties&gt;
      &lt;Appenders&gt;
          &lt;RollingFile name="RollingFile" fileName="${log-path}/MLMServices.log" filePattern="${log-path}/MLMServices-%d{yyyy-MM-dd}-%i.log" &gt;
      ....
  </code></pre>
  
  <p>Next, instead of hardcoding the managed server name "MLMAppSrv01", I changed it to a property substitution, using "${weblogic.Name}", as shown here: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="DEBUG"&gt;
      &lt;Properties&gt;
          &lt;Property name="log-path"&gt;E:/MLM/MLMDomain/servers/${weblogic.Name}/logs&lt;/Property&gt;
      &lt;/Properties&gt;
      &lt;Appenders&gt;
          &lt;RollingFile name="RollingFile" fileName="${log-path}/MLMServices.log" filePattern="${log-path}/MLMServices-%d{yyyy-MM-dd}-%i.log" &gt;
      ....
  </code></pre>
  
  <p>Now, instead of replacing ${weblogic.Name} with the actual WebLogic server name, log4j2 simply treated ${weblogic.Name} as an actual sub-folder name, so I ended up having my log file created in the folder:</p>
  
  <pre><code>E:/MLM/MLMDomain/servers/${weblogic.Name}/logs
  </code></pre>
  
  <p>In the web service codes, when I use System.getProperty("weblogic.Name"), I was able to get the actual managed server that the application was running on, which is "MLMAppSrv01". So it shows that "weblogic.Name" is indeed defined in the JVM.</p>
  
  <p>When I use the modified log4j2.xml file in a stand-alone program, passing in -Dweblogic.Name=MLMAppSrv01, it works fine and the file is created in:</p>
  
  <pre><code>E:/MLM/MLMDomain/servers/MLMAppSrv01/logs
  </code></pre>
  
  <p>What could be the reason that the ${} in log4j2.xml is not working in WebLogic?</p>
  
  <p>Thanks in advance.</p>