Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added Logging Request Example XML

...

  • Wiki Markup
    Prior to Tomcat 5.5, Tomcat provided a Logger element that you could configure and extend according to your needs. If you are using a Tomcat version previous to Tomcat 5.5, make sure to read the \[http://tomcat.apache.org/tomcat-5.0-doc/config/logger.html Logger configuration reference\].
  • Wiki Markup
    Starting with Tomcat 5.5, Logger was removed and \[http://jakarta.apache.org/commons/logging Jakarta Commons-Logging\] {{Log}} is used everywhere in Tomcat. Read the Commons-Logging documentation if you'd like to know how to better use and configure Tomcat's internal logging. See also \[http://tomcat.apache.org/tomcat-5.5-doc/logging.html\]
  • Wiki Markup
    To enable request logging similar to the Apache HTTP server, you may include the following line in the server.xml file, in the <Engine> tag:
              <Valve className="org.apache.catalina.valves.AccessLogValve"
                         directory="logs"  prefix="localhost_access_log." suffix=".log"
                         pattern="common" resolveHosts="false"/>
      This will produce a log file for each day,  such as  logs/localhost_access_log.2008-03-10.log, containing the files requested, IP address of the requester, and similar information.
        128.34.123.121 - - \[10/Mar/2008:15:55:57 -0500\] "GET /upload/ClickPoints.jsp HTTP/1.1" 200 2725
    \\
    \\

Wiki Markup
In addition, Tomcat does not swallow the System.out and System.err JVM output streams. You may use these streams for elementary logging if you wish, but a more robust approach such as commons-logging or \[http://logging.apache.org/log4j Log4J\] is recommended for production applications.

...