title: Where does maven search for log4j.properties file?
body: <p>I am facing issues using log4j with Maven. I've one properties file i.e <code>log4j.properties</code> and I've put that file at the same path where project's <code>pom.xml</code> is stored.</p>
  <p><strong>pom.xml</strong></p>
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>I've used log4j in my code which is under <code>test</code> folder.</p>
  <p><strong>Code</strong></p>
  <pre><code>package com.example.automationtest;
  
  import org.apache.log4j.*;
  import org.junit.Test;
  
  public class AppTest
  {
      @Test
      public void testLogger(){
     //PropertyConfigurator.configure(&quot;C:\\Users\\Desktop\\AutomationTest\\log4j.properties&quot;);
      Logger log = Logger.getLogger(&quot;exampleLogger&quot;);
      log.debug(&quot;Hello, World!&quot;);
     }
  }
  </code></pre>
  <p>I would like to know, how does maven identify where the log4j.properties file is located?</p>
  <p>In the above scenario if I run the command <code>mvn test</code> it gives a warning, please check the screenshot below for warning messages.</p>
  <p><img src="https://i.stack.imgur.com/tc2A1.jpg" alt="enter image description here" /></p>
  <p>so as a workaround I am providing the complete path of log4j.properties in my code. I've used below line:</p>
  <pre><code>PropertyConfigurator.configure(&quot;C:\\Users\\Desktop\\AutomationTest\\log4j.properties&quot;)
  </code></pre>
  <p>Is it necessary to use the above line of code, or is there any specific directory where maven looks for <code>log4j.properties</code> file?</p>