server:
port: 8083
tomcat:
max-connections: 500
max-threads: 500
accesslog:
enabled: true
directory: logs/access/
prefix: access_log
suffix: .log
file-date-format: .yyyy-MM-dd
pattern: "%t [%I] %{X-Forwarded-For}i %l %u %r %s %b %D"
配置文件配置如上,启动spring boot项目,access log日志文件死活不生效,然后又改成properties配置文件格式,
server.port=8081
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=common
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.suffix=.log
还是不生效,后面加了tomcat这个basedir立马生效或者server.tomcat.accesslog.directory填写为绝对路径也可生效
,完整配置如下:
server:
port: 8083
tomcat:
basedir: 自定义目录
max-connections: 500
max-threads: 500
accesslog:
enabled: true
directory: logs/access/ #或者用绝对路径如 /home/app/logs/access,上面的basedir就可以去掉不用了
prefix: access_log
suffix: .log
file-date-format: .yyyy-MM-dd
pattern: "%t [%I] %{X-Forwarded-For}i %l %u %r %s %b %D"
server.port=8081
server.tomcat.basedir=自定义目录
server.tomcat.accesslog.directory=logs #或者用绝对路径如/home/app/logs/access,用绝对路径后上面的server.tomcat.basedir即可去掉
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=common
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.suffix=.log