Configure the tomcat accesslog log in the configuration file application.yml:
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
Log recording format (pattern), refer to the form:
nginx log 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" "-"'rrree
The above is the detailed content of How SpringBoot configures tomcat access_log log. For more information, please follow other related articles on the PHP Chinese website!