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

查看:184
本文介绍了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../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天全站免登陆