SpringBoot如何配置tomcat access_log日志
作者:暮色微凉
时间:2023-05-10
来源:互联网
浏览:0
在配置文件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
2026-09-16 17:44
密码键盘
2026-09-16 17:43
3dmax快捷键失效了怎么办
2026-09-16 13:53
Xiaomi 18 Fold首销数据解读:较上代大折叠增长310%的原因与配置分析
2026-09-08 16:55
PDF文件太大怎么压缩?在线减小体积的操作步骤
2026-09-03 11:12
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多
Windows 10
Windows
Windows 10 是一款微软推出的经典操作系统,拥有硬件兼容性与多任务处理能力。它更偏向把系统状态查看和常用调节动作放在一起,适合需要持续观察和微调设备状态的场景。
极度公式
Windows/macOS/Linux
极度公式是一款跨平台专业LaTeX公式识别编辑软件,支持OCR公式识别和多平台编辑。和使用说明,避免使用,享受完整功能与稳定支持。做扫描整理、文字提取和表格转换时,它能把识别后的处理步骤接得更顺,资料录入这类场景会省下不少时间。
















