Spring Boot启用http请求日志记录(访问日志) [英] Spring Boot enable http requests logging (access logs)

查看:233
本文介绍了Spring Boot启用http请求日志记录(访问日志)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 spring boot 提供的嵌入式 tomcat 服务器中启用访问日志?我已经在application.properties中尝试过此操作,但是它不会创建文件,也不会登录到控制台.

How to enable access logs in an embedded tomcat server provided by spring boot? I've tried this in application.properties but it doesn't create file, neither logs to console.

server.tomcat.access-log-enabled=true
server.tomcat.access-log-pattern=%a asdasd
logging.file=/home/mati/mylog.log

推荐答案

尝试

server.tomcat.accessLogEnabled=true
server.tomcat.accessLogPattern=%a asdasd

,然后在/tmp/tomcat.<random>.<port>/logs中查找输出文件.设置server.tomcat.basedir属性以更改目录.

and look in /tmp/tomcat.<random>.<port>/logs for the output files. Set server.tomcat.basedir property to change the directory.

这篇关于Spring Boot启用http请求日志记录(访问日志)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆