title: What is the best way to use log4j in the web application?
body: <p>We are starting a Spring MVC based web application. We will be using tomcat as the web server. </p>
  
  <p>I need to configure log4j in the application and log to the application specific file and not to the tomcat log files. </p>
  
  <p>e.g. tomcat has its own log files like localhost.log etc. I want something like myAppName.log in the tomcats log folder. </p>
  
  <p>The logging configuration will go in lo4j.xml or log4j.properties in the application war file.</p>
  
  <p>Plus I dont want to hard code the output log file in the web application.</p>
  
  <p>But I am not sure how to do this.</p>
  
  <p>Please help me. As well correct me if I am wrong somewhere.</p>