title: Loading Log4j.xml from outside fo the war
body: <p>In my application iam using Log4j for logging.Presently I am placing log4j.xml in WEB-INF/classes. 
  Below are the configurations i am using to load log4j.xml file.</p>
  
  <pre><code>&lt;!-- language: xml --&gt;
  
      &lt;context-param&gt;
            &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
           &lt;param-value&gt;/WEB-INF/classes/log4j.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
         &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;
      &lt;/listener&gt; 
  </code></pre>
  
  <p>Now I need to place log4j.xml file outside of my war file. The location will be most likely JBOSS_HOME/server/default/deploy/settings. In settings directory i need to place my log4j.xml.</p>
  
  <p>I tried to load it by setting jboss class path by editing run.bat as follows
  set JBOSS_CLASSPATH=%RUN_CLASSPATH%;%JBOSS_HOME%\server\default\deploy\settings
  and i used below in web.xml </p>
  
  <pre><code>&lt;!-- language: xml --&gt;
  
      &lt;context-param&gt;
              &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;classpath:/log4j.xml&lt;/param-value&gt;  
      &lt;/context-param&gt;
  
      &lt;listener&gt;
              &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;
      &lt;/listener&gt; 
  </code></pre>
  
  <p>But it throwing exception while deploying application. Exception is 
  <code>java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [/log4j.xml] cannot be resolved to URL because it does not exist</code></p>
  
  <p>Now my question is how can I load it.</p>