使用spring-boot 1.2.3.RELEASE。
让spring-boot登录到特定目录的唯一方法是像这样设置"log.file“属性:
logging.file=/var/log/app.log
但据我所知according to the docs我应该做的是:
logging.file=app.log
logging.path=/var/log
但它似乎并没有监听logging.path属性,它只是将文件写入当前目录。
是文档错了,还是我在这里遗漏了什么?
而且,在这个设置下,它仍然可以正确地执行日志滚动,对吧?
发布于 2020-07-19 23:48:26
在application.properties中,只需使用以下变量
logging.file.path={--your file path--}
发布于 2021-05-10 17:27:45
使用spring 2.4.5
这就是工作
logging.file.path=./log/
logging.file.name=${logging.file.path}mylog.txt
或
logging.file.name=./log2/mylog.txt
总而言之
logging.file.path=. # write logs to the current directory
logging.file.path=/home/logs # write logs to /home/logs
logging.file.path=/mnt/logdir # write logs to /mnt/logdir
对于Spring Boot1.x:设置logging.path
https://stackoverflow.com/questions/29764258
复制相似问题