我是Tomcat4.1 在Tomcat 4.1\conf下server.xml中
下面一段是记录访问日志的设置,缺省是disabled,把注释去掉,可以记录访问日志。       <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>如果resolveHosts="true",则记录客户端主机名,否则记录客户端IP

解决方案 »

  1.   

    日志记录在tomcat logs下localhost_access_log.当前日期.txt中
      

  2.   

    如果还要记录ip怎么办呀
    -------------------------------------------------
    我是Tomcat4.1 在Tomcat 4.1\conf下server.xml中
    下面一段是记录访问日志的设置,缺省是disabled,把注释去掉,可以记录访问日志。       <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="logs"  prefix="localhost_access_log." suffix=".txt"
                     pattern="common" resolveHosts="false"/>如果resolveHosts="true",则记录客户端主机名,否则记录客户端IP
      

  3.   

    看了一下tomcat的源码,你通过设置模式,可以达到目的。
          <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="logs"  prefix="localhost_access_log." suffix=".txt"
                     pattern="%a %h %l %u %t %r %s %b" resolveHosts="false"/>下面是源码中摘录的参数的含义* <li><b>%a</b> - Remote IP address
     * <li><b>%A</b> - Local IP address
     * <li><b>%b</b> - Bytes sent, excluding HTTP headers, or '-' if no bytes
     *     were sent
     * <li><b>%B</b> - Bytes sent, excluding HTTP headers
     * <li><b>%h</b> - Remote host name
     * <li><b>%H</b> - Request protocol
     * <li><b>%l</b> - Remote logical username from identd (always returns '-')
     * <li><b>%m</b> - Request method
     * <li><b>%p</b> - Local port
     * <li><b>%q</b> - Query string (prepended with a '?' if it exists, otherwise
     *     an empty string
     * <li><b>%r</b> - First line of the request
     * <li><b>%s</b> - HTTP status code of the response
     * <li><b>%S</b> - User session ID
     * <li><b>%t</b> - Date and time, in Common Log Format format
     * <li><b>%u</b> - Remote user that was authenticated
     * <li><b>%U</b> - Requested URL path
     * <li><b>%v</b> - Local server name
     * <li><b>%D</b> - Time taken to process the request, in millis
     * <li><b>%T</b> - Time taken to process the request, in seconds