今天在使用slf4j时发现熟悉的配置不见了,取而代之的是logging.file.name和logging.file.path,可是这两条对于我来说并不熟悉,于是我在网上学习了一下
最关键的自然是看看官网文档了,看看Spring上是怎么说的
logging.file.name | logging.file.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 directory | /var/log | Writes spring.log to the specified directory. Names can be an exact location or relative to the current directory. |
很显然了
当不使用这两条指令时,默认的是将日志打印在控制台上,而使用
logging.file.name 可以指定路径和log文件的名字
logging.file.path 只可以只当log的路径, 不能指定log的名字, 使用缺省值spring.log
而且要记住的是:二者只可以存在一个生效,所以不要犯迷糊啊