SpringBoot项目集成WEB容器tomcat、undertow,access log配置,注意两者的微小差别,tomcat的日志目录关键字是basedir,undertow是directory。tomcat的扩展打印http头日志格式是%{xxx}i,undertow的扩展打印http头日志格式是%{i,xxx}
- 集成tomcat
1 | server.tomcat.basedir=${log.path} |
其中pattern 常用模式:common、combined
- common -
%h %l %u %t "%r" %s %b
- combined -
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"
自定义pattern:
- 集成undertow
1 | server.undertow.accesslog.directory=${log.path} |
其中pattern 常用模式:common、combined
- common -
%h %l %u %t "%r" %s %b
- combined -
%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
自定义pattern: