Tomcat伺服器日誌輸出格式設定

2021-08-18 03:36:47 字數 1169 閱讀 7262

tomcat伺服器日誌輸出格式設定

@(tomcat)

功能要求

設定日誌輸出格式,使其符合需求

期望輸出:

172.26.131.37

2017-05-19

08:50:35 get /lemis/sysmanager/aa12/getqh?aaa023=33010606&type=3&_=1495155503750

20087

0.016

實際輸出:

192.16.28.104 [05/may/2017:00:02:15 +0800] - get / 200

00.000

處理過程

1.server.xml修改

classname="org.apache.catalina.valves.accesslogvalve"

directory="logs"

prefix="localhost_access_log."

suffix=".txt"

pattern="%a %t %m %u %s %b %t"

filedateformat="yyyy-mm-dd"/>

classname="org.apache.catalina.valves.accesslogvalve"

directory="logs"

prefix="demo_localhost_access_log."

suffix=".txt"

pattern="%a %t %m %u %s %b %t"

filedateformat="yyyy-mm-dd"/>

2.更新伺服器檔案,重啟伺服器

server.xml 檔案放入tomcat伺服器conf資料夾內,重啟專案伺服器。

相關博文

配置tomcat的訪問日誌格式化輸出

tomcat access log 統計相應時間

tomcat6官方配置文件

tomcat accesslog 格式化

❤apache access_log日誌詳解

c 庫函式 - strftime()詳解

tomcat伺服器不輸出訪問日誌

有時候乙個web服務作為介面部署在tomcat下,因為訪問很頻繁,導致 var log tomcat7下的訪問日誌急劇膨脹,影響伺服器的效能。在這裡我的方法是關閉訪問日誌,關閉方法為將訪問日誌的輸出在配置檔案中注釋掉,我的伺服器是ubuntu,tomcat7是自動安裝的,開啟 etc tomcat7...

Python日誌輸出格式和時間格式

formatter logging.formatter asctime s levelname s message s y b d h m s 上面的 y等是時間格式,所以要想理解上面要表示個什麼,先來看一下python的時間格式。我們的樣例是以年月日 時 分 秒的形式顯示日期的。除此之外,還要理解...

Tomcat伺服器修改預設編碼格式

編寫 時,頁面通過伺服器傳遞引數,有時遇到頁面或後台出現亂碼卻找不到出處時 即jsp ide controller或servlet全部編碼格式都是utf 8時 可以考慮是不是伺服器的編碼出現了問題,現給出修改tomcat伺服器預設編碼格式的方法 找到tomcat目錄下的conf資料夾,開啟編輯其中的...