title: Log4J out to console and file produces warnings/errors log4j:WARN File option not set for appender
body: <p>I'd like to integrate Log4J logging into my Java application, writing information out to a log  file as well as displaying the info at the console.  Unfortunately, I've had some trouble getting this off the ground.  I'm working with Eclipse Juno on Win 7.</p>
  
  <p>My log4j.properties file:</p>
  
  <pre><code>#configure logfile
  log4j.appender.logfile = org.apache.log4j.RollingFileAppender
  log4j.appedner.logfile.File = MyAppLog.log
  log4j.appender.logfile.Append = true
  log4j.appender.logfile.layout = org.apache.log4j.PatternLayout
  log4j.appender.logfile.layout.ConversionPattern = %-5p %d [%t][%F:%L] : %m%n
  
  #configure 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 = %-5p %d [%t][%F:%L] : %m%n
  
  log4j.rootLogger = debug, logfile, stdout
  </code></pre>
  
  <p>I belive the above follows the pattern of some other <a href="https://stackoverflow.com/questions/16281695/log4jlogs-are-displying-on-console-but-file-is-not-getting-updated">accepted answers on this topic</a>.</p>
  
  <p>I've specifed the location of this log4j.properties file wtih a VM argument:</p>
  
  <pre><code>-Dlog4j.configuration=file:///${workspace_loc}\path\to\file\log4j.properties
  </code></pre>
  
  <p>I instantiate the logger in my java class:</p>
  
  <pre><code>static Logger logger = Logger.getLogger(MyApp.class.getName());
  </code></pre>
  
  <p>log a string:</p>
  
  <pre><code>logger.info("barfoo");
  </code></pre>
  
  <p>This configuration results in the following warnings/errors on launch:</p>
  
  <pre><code>log4j:WARN File option not set for appender [logfile].
  log4j:WARN Are you using FileAppender instead of ConsoleAppender?
  log4j:ERROR No output stream or file set for the appender named [logfile]
  </code></pre>
  
  <p>It does not produce the log file.  The console logging seems to be working just fine, however.  </p>