SpringBoot如何配置tomcataccess_log日志

本篇內(nèi)容介紹了“SpringBoot如何配置tomcat access_log日志”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供湘潭網(wǎng)站建設(shè)、湘潭做網(wǎng)站、湘潭網(wǎng)站設(shè)計(jì)、湘潭網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、湘潭企業(yè)網(wǎng)站模板建站服務(wù),十載湘潭做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

在配置文件application.yml里面來配置tomcat accesslog日志:

server:
  port: 80
  tomcat:
    accesslog:
      enabled: true
      directory: D:\Documents\D_代碼相關(guān)\J_java\sprintboot_study
      prefix: tomcat_access_log
      suffix: .log
      file-date-format: -yyyy-MM-dd
      pattern: '%{X-Real-IP}i - %{Host}i %t "%r" %{Content-Length}i %s %b %D "%{Referer}i" "%{User-Agent}i" %a "%I" "-"'
      rotate: true

日志記錄格式(pattern),形式參照 :

nginx 日志 log_format:

log_format main '$http_x_real_ip - $http_host [$time_local] "$request" $request_length '
                             '$status $body_bytes_sent $request_time "$http_referer" '
                             '"$http_user_agent" $remote_addr "-" "-" ';

tomcat access log pattern:

pattern: '%{X-Real-IP}i - %{Host}i %t "%r" %{Content-Length}i'
              '%s %b %D "%{Referer}i"'
             '"%{User-Agent}i" %a "%I" "-"'
%{X-Real-IP}i: http X-Real_IP
%{Host}i: http Host
%t: Date and time, in Common Log Format
%r: First line of the request (method and request URI)
%{Content-Length}i: request length
%s: HTTP status code of the response
%b: Bytes sent, excluding HTTP headers, or ‘-’ if zero
%D: Time taken to process the request, in millis
%{Referer}i: http Referer
%{User-Agent}i: http User-Agent
%a: Remote IP address
%I: Current request thread name (can compare later with stacktraces)

“SpringBoot如何配置tomcat access_log日志”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

網(wǎng)頁題目:SpringBoot如何配置tomcataccess_log日志
文章網(wǎng)址:http://muchs.cn/article8/gesdip.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序做網(wǎng)站、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站導(dǎo)航搜索引擎優(yōu)化、服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)