title: Logging in web applications: Best practices?
body: <p>During deployment of a web application (in test environment) on customer site we encountered a problem with logging of the application. I'll shortly try to describe the current situation:</p>
  
  <ul>
  <li>Implementation uses Logger retrieved by java.util.logging and
  apache.commons.logging.</li>
  <li>In the deployed packages exists a commons-logging.properties pointing to JUL.</li>
  <li>Application is running on Tomcat 6.x</li>
  </ul>
  
  <p>The customer decided that he wants to use Log4J on tomcat and configured it so it works (generally) - of course it's not working for the mentioned application.</p>
  
  <p>As it seems that we need to change logging implementation anyway - i wanted to ask you for some best practices on how to implement logging in a web application.
  Following things should be possible:</p>
  
  <ul>
  <li>Customer needs to be able to change log-level without modifying anything in the *.war-file. -> If he would have to modify the war-file he would have to do this for every new build ...</li>
  <li>It should be possible to have some kind of rolling-file-logging (e.g.: max 10 files with max. 10mb each) - of course it should also be up to the customer to define and change this setting ...</li>
  <li>As another customer might want to use standard JUL-logging instead - I'd of course prefer to not hard-code the preferred library (Log4J in this case).</li>
  </ul>