title: Why I obtain this FileNotFoundException when I try to use log4j to write into a file?
body: <p>I am absolutly new using <strong>log4j</strong> and I have the following problem.</p>
  
  <p>I am trying to print the logging line into a file named <strong>log.out</strong>.</p>
  
  <p>So I create the following <strong>log4j.properties</strong> configuration file:</p>
  
  <pre><code># Define the root logger with appender file
  log4j.rootLogger = DEBUG, FILE
  
  # Define the file appender
  log4j.appender.FILE=org.apache.log4j.FileAppender
  log4j.appender.FILE.File=${log}/log.out
  
  # Define the layout for file appender
  log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
  log4j.appender.FILE.layout.conversionPattern=%m%n
  </code></pre>
  
  <p>The problem is that, when I perform my application and when it incurs in a logging operation, something like this:</p>
  
  <pre><code>logger.debug("INTO main()");
  </code></pre>
  
  <p>I obtain the following exception into the console (the error message related to the <strong>log.out</strong> file is <strong>access denied</strong> (in italian Accesso negato):</p>
  
  <pre><code>log4j:ERROR setFile(null,true) call failed.
  java.io.FileNotFoundException: \log.out (Accesso negato)
          at java.io.FileOutputStream.open(Native Method)
          at java.io.FileOutputStream.&lt;init&gt;(Unknown Source)
          at java.io.FileOutputStream.&lt;init&gt;(Unknown Source)
          at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
          at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163)
          at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:2
  56)
          at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
  ava:132)
          at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
  ava:96)
          at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigura
  tor.java:654)
  </code></pre>
  
  <p>and don't write nothing into my <strong>log.out</strong> file (that I have created manually). This <strong>log.out</strong> file is at the same level of the performed jar file that represent my application.</p>
  
  <p>Why? What am I missing? How can I solve this issue?</p>
  
  <p>Tnx</p>