title: How do I configure my pom to use one log4j.properties file for main and test?
body: <p>I have a log4j.properties file in src/main/resources.  When I run my tests only console logging occurs, but not file appender logging.  I would like to point to the same properties file for my tests.</p>
  
  <p>I've learned this is possible to do in my pom file with a the test scope and a -D argument.  How is this done?</p>
  
  <p>Here is my log4j.properties file:</p>
  
  <pre><code># ROOT CATEGORY is used to set level of logger and appender name 
  log4j.rootCategory=DEBUG, CA, RA 
  # DEBUG is a root level and FA, CA, DA are appender name (appender name can be different) 
  
  # ---------- CA is set to be a ConsoleAppender ---------- 
  
  # Write to Console(stdout or stderr). 
  log4j.appender.CA=org.apache.log4j.ConsoleAppender 
  # This appender will only log messages with priority equal to or higher than the one specified here 
  # hierarchy of level is (from lower to higher): DEBUG,INFO,WARN,ERROR,FATAL 
  log4j.appender.CA.Threshold=DEBUG 
  # appender layouts (log formats) 
  #log4j.appender.CA.layout=org.apache.log4j.SimpleLayout 
  log4j.appender.CA.layout=org.apache.log4j.PatternLayout 
  # For a pattern layout, specify the pattern (Default is %m%n which is fastest) 
  log4j.appender.CA.layout.ConversionPattern=[%-5p] %c - %m%n 
  
  # ---------- RA is set to be a RollingFileAppender ---------- 
  
  # Write log to a file, roll the file after some size 
  log4j.appender.RA=org.apache.log4j.RollingFileAppender 
  # This appender will only log messages with priority equal to or higher than the one specified here 
  log4j.appender.RA.Threshold=DEBUG 
  # The name of log file 
  log4j.appender.RA.File= \log4j.log 
  # The maximum log file size 
  log4j.appender.RA.MaxFileSize=10MB 
  # Don't append, overwrite 
  #log4j.appender.RA.Append=false 
  # Keep backup file(s) (backups will be in filename.1, .2 etc.) 
  log4j.appender.RA.MaxBackupIndex=1 
  # appender layouts (log formats) 
  #log4j.appender.RA.layout=org.apache.log4j.SimpleLayout 
  log4j.appender.RA.layout=org.apache.log4j.PatternLayout 
  # For a pattern layout, specify the pattern (Default is %m%n which is fastest) 
  log4j.appender.RA.layout.ConversionPattern=[%-5p] %c - %m%n 
  </code></pre>