title: Springboot externalizing log4j configuration
body: <p>In a springboot application, I have a single jar, and then a subdirectory config with application.properties, applicationContext.xml, and log4j...properties file.</p>
  
  <p>I am trying to externalize the log4j config. The application.properties is externalized this way.</p>
  
  <p>But, when springboot runs it is using the log4j config file from within the jar file.  By using the  -Dlog4j.debug option I can see that log4j uses my external file first, but when spring starts it overrides the log4j setting with the one in the jar.</p>
  
  <p>here is an example startup (with all options)</p>
  
  <pre><code>java -Dlog4j.debug 
     -Dlogging.config="file:/opt/config/log4j-qa.properties" 
     -Dlog4j.configuration="file:/opt/config/log4j-qa.properties" 
     -jar /opt/myjarName.jar 
     --spring.config.location=/opt/config/
  </code></pre>
  
  <p><strong>on first startup log4j states</strong>
  log4j: Reading configuration from URL file:/opt/config/log4j-qa.properties</p>
  
  <p><strong>then on springboot start</strong>
  log4j: Reading configuration from URL jar:file:/opt/dms-events-api.jar!/log4j-qa.properties</p>
  
  <p>but I want it to read only the external file file:/opt/config/log4j-qa.properties</p>