File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
- ###73 .1.1 Configure logback for file only output
1
+ ###73 .1.1 配置logback只输出到文件
2
+
3
+ 如果想禁用控制台日志记录,只将输出写入文件中,你需要一个只导入` file-appender.xml ` 而不是` console-appender.xml ` 的自定义` logback-spring.xml ` :
4
+ ``` xml
5
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
6
+ <configuration >
7
+ <include resource =" org/springframework/boot/logging/logback/defaults.xml" />
8
+ <property name =" LOG_FILE" value =" ${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}" />
9
+ <include resource =" org/springframework/boot/logging/logback/file-appender.xml" />
10
+ <root level =" INFO" >
11
+ <appender-ref ref =" FILE" />
12
+ </root >
13
+ </configuration >
14
+ ```
15
+ 你还需要将` logging.file ` 添加到` application.properties ` :
16
+ ``` properties
17
+ logging.file =myapplication.log
18
+ ```
You can’t perform that action at this time.
0 commit comments