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)
作者最新文章
打印机无法打印wps文档 排查打印设置
2026-11-08 23:23
PDF怎么按页拆成单独文件?PDF按页拆分后怎么命名
2026-11-03 18:00
长网页转PDF怎么避免断图?网页转PDF怎么设置分页
2026-11-01 09:31
夸克资源库蓝光资源每日更新经典电视剧全集
2026-10-30 11:54
会声会影怎么导入音频 支持格式及步骤
2026-10-29 12:23
热门文章
更多
精品专题
更多
Mac软件
更多
火山引擎 网页版
Windows/ macOS/ Linux
火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。
















