title: How to configure another log4j configuration file in Tomcat?
body: <p>I am using log4j1.2, and I am new to log4j.</p>
  
  <p>I hope that when I am debugging in my local machine ,the logs will be printed to console.
  But when it is running in PROD , it just logs to file, since I hope to have the least overhead.</p>
  
  <p>I hope that I can achieve this(only print to console when in local machine rather than the prod env) without modifying the properties file every time when I deploy. </p>
  
  <p>Here is what my log4j.properties looks like：</p>
  
  <pre><code>log4j.rootLogger=DEBUG,BAE,console,error
  
  
  ##################production logs###############
  log4j.appender.BAE=org.apache.log4j.FileAppender
  log4j.appender.BAE.encoding=utf-8
  log4j.appender.BAE.Append=true
  log4j.appender.BAE.Threshold=INFO
  log4j.appender.BAE.layout=org.apache.log4j.SimpleLayout
  
  
  ####################Conole logs####################
  ##(hope only enable when debuging in local machine)
  log4j.appender.console= org.apache.log4j.ConsoleAppender
  log4j.appender.console.encoding=utf-8
  ## DEBUG logs
  log4j.appender.console.Threshold = Trace 
  log4j.appender.console.layout=org.apache.log4j.SimpleLayout
  
  
  ##################error logs##########################
  log4j.appender.error=org.apache.log4j.FileAppender
  log4j.appender.error.File=/home/bae/log/error.log 
  log4j.appender.error.Threshold = ERROR  
  log4j.appender.error.Append=true
  log4j.appender.error.layout=org.apache.log4j.SimpleLayout
  </code></pre>