Spring Boot日志配置中的file和path注意事项

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/russle/article/details/83480135

注意:同时配置了logging.file和logging.path只有一个生效。

例如 application.properties文件中的日志配置如下

logging.file=mylog.txt
logging.path=/var/myapp/

实际只有logging.file=mylog.txt生效,程序并保护会在/var/myapp目录下生成mylog.txt。

如果我们需要配置日志路径,可以在logging.file中配置。例如logging.file=/my-folder/my-file.txt

参看官方文档
Table 26.1. Logging properties

logging.file ogging.path Example Description 说明
(none) (none) Console only logging
Specific file (none) my.log Writes to the specified log file. Names can be an exact location or relative to the current directory.
(none) Specific file /var/log Writes spring.log to the specified directory. Names can be an exact location or relative to the current directory.

猜你喜欢

转载自blog.csdn.net/russle/article/details/83480135