2011-05-02 111 views
1

我是新手到Tomcat,并试图找到这个论坛和网络的答案,但都没有很成功所以我在这里。Tomcat的日志记录(如Apache)

我想每次访问留给我的Tomcat服务器,包括转诊,浏览器信息等,我认为我获得Apache(默认?)。有没有办法做到这一点在tomcat(最好只是打开一些选项)。我看了看我的tomcat安装的日志目录,但我无法找到类似于我在寻找什么。

回答

3

如果我理解正确的话,请点击这里:http://wiki.apache.org/tomcat/FAQ/Logging#Q1

从3子弹点,第一个问题:

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 

希望有所帮助。

+0

不会得到引用或浏览器(用户代理);为此,将“普通”替换为“组合”。 – toddkaufmann 2012-12-15 19:33:02