title: Using log4j how to print System.out.println statements in logfile
body: <p>I am learning log4j still and I facing this problem.</p>
  
  <p>As in my current example I not able to print <strong>System.out.println</strong> statements in logfiles.</p>
  
  <p>I have gone through other question and answers in the Stack Overflow and it is a duplicate question, but I still did not understand those.</p>
  
  <p>Below is Java class</p>
  
  <pre><code>public class Testing
  {
  private final static Logger logger = Logger.getLogger(Testing.class);
  static
  {
      PropertyConfigurator.configure("log4j.properties");
  }
  public static void main(String args[])
  {
      System.out.println("Entered main method...............");
      logger.error("An error has occurred might");
  }
  }
  </code></pre>
  
  <p>log4j.properties file:</p>
  
  <pre><code>log4j.rootLogger=DEBUG, file, console
  
  log4j.appender.file=org.apache.log4j.RollingFileAppender
  log4j.appender.file.File=logs/justfortesting.log
  log4j.appender.file.Append=true
  log4j.appender.file.ImmediateFlush=true   
  log4j.appender.FILE.filter.b=org.apache.log4j.varia.LevelMatchFilter    
  log4j.appender.FILE.filter.b.LevelToMatch=ERROR    
  log4j.appender.FILE.filter.b.AcceptOnMatch=false 
  log4j.appender.file.layout=org.apache.log4j.PatternLayout
  log4j.appender.file.layout.ConversionPattern=%d %d{Z} [%t] %-5p (%F:%L) - %m%n
  
  log4j.logger.com.log4j=DEBUG, file, console
  
  log4j.additivity.com.log4j=false
  </code></pre>
  
  <p>So anyone suggest, what I need to change/add new things to this??</p>