Tomcat: recommandations for logging
        Posted  
        
            by WizardOfOdds
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by WizardOfOdds
        
        
        
        Published on 2010-04-05T04:47:31Z
        Indexed on 
            2010/04/05
            4:53 UTC
        
        
        Read the original article
        Hit count: 339
        
I've read several questions here concerning Tomcat and logging but I still really don't understand the "bigger picture", hence my question:
How and where are my Webapps supposed to do their logging?
By default on my setup Tomcat 6.0.20 logs go in the following file/appender:
./apache-tomcat-6.0.20/logs/catalina.out
Am I suppose to have my webapps also log to this file/appender?
Let say my case is trivially simple and I've got just one servlet:
import ... // What do I import here in order to be able to log?
public class SOServlet extends HttpServlet {
    public void doGet(
        final HttpServletRequest request,
        final HttpServletResponse response
    ) throws IOException, ServletException {
    ... // I want to log here, what do I write?
What are the gotchas knowing that there are more than one webapp running on the same Tomcat? (apparently from reading the various questions there are many gotchas).
What about the .war, do I need to put log4j/sl4f/commons-logging/whatever in my .war?
© Stack Overflow or respective owner