title: how to use log4j to write a file inside my project directory?
body: <p>I have a log4j properties file which is creating a file inside my tomcat>bin folder but instead can it write the log file to my project's root dir? <strong>webapps>test><em>_</em>__</strong>?</p>
  
  <p>Here is my log4j properties file contents.</p>
  
  <pre><code>#define the console appender
  log4j.appender.consoleAppender = org.apache.log4j.ConsoleAppender
  
  # now define the layout for the appender
  log4j.appender.consoleAppender.layout = org.apache.log4j.PatternLayout
  log4j.appender.consoleAppender.layout.ConversionPattern=%t %-5p %c{3} - %m%n
  
  log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
  log4j.appender.rollingFile.File=/test/a.log
  log4j.appender.rollingFile.MaxFileSize=10MB
  log4j.appender.rollingFile.MaxBackupIndex=2
  log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
  log4j.appender.rollingFile.layout.ConversionPattern=%p %t %c - %m%n
  
  # now map our console appender as a root logger, means all log messages will go to this appender
  #for console printing
  #log4j.rootLogger = DEBUG, consoleAppender   
  
  #for file printing
  log4j.rootLogger = DEBUG, rollingFile   
  </code></pre>