SpringBoot如何配置tomcat access_log日志
作者:暮色微凉
时间:2023-05-11
浏览:4
在配置文件application.yml里面来配置tomcataccesslog日志:server:port:80tomcat:accesslog:enabled:truedirectory:D:\Documents\D_代码相关\J_java\sprintboot_studyprefix:tomcat_access_logsuffix:.logfile-date-format:-yyyy-MM-ddpattern:'%{X-Real-IP}i-%{Host}i%t"%r"%{Content-Le
本文目录
在配置文件application.yml里面来配置tomcat accesslog日志:
server:
port: 80
tomcat:
accesslog:
enabled: true
directory: D:\Documents\D_代码相关\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)
作者最新文章
长网页转PDF怎么避免断图?网页转PDF怎么设置分页
2026-11-01 09:31
夸克资源库蓝光资源每日更新经典电视剧全集
2026-10-30 11:54
会声会影怎么导入音频 支持格式及步骤
2026-10-29 12:23
WPS表格常用功能实操:从录入到排序筛选的完整流程
2026-10-29 09:57
B站免费入口永久有效网址推荐
2026-10-28 16:37
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多

































