【SpringBoot】 開啟tomcat log

 

 application.properties

https://docs.spring.io/spring-boot/docs/3.1.6/reference/htmlsingle/#appendix.application-properties.server

server.tomcat.accesslog.buffered=true
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd
server.tomcat.accesslog.pattern=%{yyyy-MM-dd HH:mm:ss}t %a %A %p %m %U %q %s %T %H  %{referer}i %v %I %b %S %u
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.rename-on-rotate=false
server.tomcat.accesslog.request-attributes-enabled=false
server.tomcat.accesslog.rotate=true
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.directory=logs
server.tomcat.basedir=${workspace.path}/docker/log/liveportal

tomcat log pattern 文件 https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html

There is also support to write information incoming or outgoing headers, cookies, session or request attributes and special timestamp formats. It is modeled after the Apache HTTP Server log configuration syntax. Each of them can be used multiple times with different xxx keys:

All formats supported by SimpleDateFormat are allowed in %{xxx}t. In addition the following extensions have been added:


修訂版本 #3
由 treeman 建立於 9 2023 15:39:56
由 treeman 更新於 24 2024 10:15:08