title: Where to put log4j.properties in a maven project?
body: <p>I know it's a cliché question and I readed all the documents and I tried many solutions but always no solution worked for me !!  but I put the log4j.properties in the <strong><em>src/main/resources</em></strong> and also in <strong><em>src/main/java</em></strong> and I've added <code>PropertyConfigurator.configure("log4j.properties");</code>to my class but when I turn my project to a <strong>Runnable JAR</strong> it shows me : </p>
  
  <pre><code>C:\Users\eya\Desktop&gt;java -jar RestCallAutomation.jar
  log4j:WARN No appenders could be found for logger (com.infosquare.restautomation.AppController).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  log4j:ERROR Could not read configuration file [log4j.properties].
  java.io.FileNotFoundException: log4j.properties (Le fichier spécifié est introuvable)
          at java.io.FileInputStream.open0(Native Method)
          at java.io.FileInputStream.open(Unknown Source)
          at java.io.FileInputStream.&lt;init&gt;(Unknown Source)
          at java.io.FileInputStream.&lt;init&gt;(Unknown Source)
          at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:372)
          at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403)
          at com.infosquare.restautomation.GenerateProcessors.start(GenerateProcessors.java:34)
          at com.infosquare.restautomation.AppController$2.run(AppController.java:98)
          at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
          at java.security.AccessController.doPrivileged(Native Method)
          at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
          at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
          at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
          at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
          at java.lang.Thread.run(Unknown Source)
  log4j:ERROR Ignoring configuration file [log4j.properties].
  </code></pre>
  
  <p>here is the architecture of my project: 
  <a href="https://i.stack.imgur.com/z7b2u.png" rel="nofollow noreferrer">maven project Architecture</a></p>
  
  <p>and here is the log4j.properties : </p>
  
  <pre><code># Root logger option
  log4j.rootLogger=INFO, file, stdout
  
  # Direct log messages to a log file
  log4j.appender.file=org.apache.log4j.RollingFileAppender
  log4j.appender.file.File=logging.log
  log4j.appender.file.MaxFileSize=10MB
  log4j.appender.file.MaxBackupIndex=10
  log4j.appender.file.layout=org.apache.log4j.PatternLayout
  log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  
  # Direct log messages to stdout
  log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  log4j.appender.stdout.Target=System.out
  log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  </code></pre>
  
  <p>here ismy pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;org.OpenText&lt;/groupId&gt;
    &lt;artifactId&gt;GenerateurCodes&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
    &lt;properties&gt;
      &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
  
    &lt;dependency&gt;
    &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
    &lt;artifactId&gt;maven-model&lt;/artifactId&gt;
    &lt;version&gt;2.2.1&lt;/version&gt;
  &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.jdom&lt;/groupId&gt;
      &lt;artifactId&gt;jdom&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;
     &lt;/dependency&gt;
   &lt;dependency&gt;
      &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
      &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
      &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
      &lt;artifactId&gt;gson&lt;/artifactId&gt;
      &lt;version&gt;2.8.5&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
      &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
      &lt;version&gt;4.5.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
      &lt;artifactId&gt;httpmime&lt;/artifactId&gt;
      &lt;version&gt;4.5.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;commons-io&lt;/groupId&gt;
      &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
      &lt;version&gt;2.5&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.velocity&lt;/groupId&gt;
      &lt;artifactId&gt;velocity&lt;/artifactId&gt;
      &lt;version&gt;1.7&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;dependency&gt;
       &lt;groupId&gt;org.apache.velocity&lt;/groupId&gt;
       &lt;artifactId&gt;velocity-tools&lt;/artifactId&gt;
       &lt;version&gt;2.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.w3c&lt;/groupId&gt;
      &lt;artifactId&gt;dom&lt;/artifactId&gt;
      &lt;version&gt;2.3.0-jaxb-1.0.6&lt;/version&gt;
  &lt;/dependency&gt;
  &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;/dependency&gt;
  
   &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <blockquote>
    <p>**UPDATE : **</p>
  </blockquote>
  
  <p><strong><em>when I open the jar using WinRar it shows me that it contains the log4j.properties and log4j jar so it s not a resources problem!</em></strong></p>