2011-05-02 79 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