File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 11### 73.1 配置Logback
22
3- 如果你将一个logback.xml放到classpath根目录下 ,那它将会被从这加载。Spring Boot提供一个默认的基本配置,如果你只是设置日志级别,那你可以包含它,比如:
3+ 如果你将 ` logback.xml ` 放到classpath根目录下 ,那它将会被从这加载(或 ` logback-spring.xml ` 充分利用Boot提供的模板特性) 。Spring Boot提供一个默认的基本配置,如果你只是设置日志级别,那你可以包含它,比如:
44``` xml
55<?xml version =" 1.0" encoding =" UTF-8" ?>
66<configuration >
77 <include resource =" org/springframework/boot/logging/logback/base.xml" />
88 <logger name =" org.springframework.web" level =" DEBUG" />
99</configuration >
1010```
11- 如果查看spring-boot jar包中的默认logback.xml,你将会看到LoggingSystem为你创建的很多有用的系统属性,比如:
12- - ${PID},当前进程id
13- - ${LOG_FILE},如果在Boot外部配置中设置了` logging.file `
14- - ${LOG_PATH},如果设置了` logging.path ` (表示日志文件产生的目录)
11+ 如果查看spring-boot jar中的` base.xml ` ,你将会看到` LoggingSystem ` 为你创建的很多有用的系统属性,比如:
12+ - ` ${PID} ` ,当前进程id。
13+ - ` ${LOG_FILE} ` ,如果在Boot外部配置中设置了` logging.file ` 。
14+ - ` ${LOG_PATH} ` ,如果设置了` logging.path ` (表示日志文件产生的目录)。
15+ - ` ${LOG_EXCEPTION_CONVERSION_WORD} ` ,如果在Boot外部配置中设置了` logging.exception-conversion-word ` 。
1516
16- Spring Boot也提供使用自定义的Logback转换器在控制台上输出一些漂亮的彩色ANSI日志信息(不是日志文件)。 具体参考默认的` base.xml ` 配置。
17+ Spring Boot也提供使用自定义的Logback转换器在控制台上输出一些漂亮的彩色ANSI日志信息(不是日志文件), 具体参考默认的` base.xml ` 配置。
1718
18- 如果Groovy在classpath下,你也可以使用logback.groovy配置Logback 。
19+ 如果Groovy在classpath下,你也可以使用 ` logback.groovy ` 配置Logback 。
You can’t perform that action at this time.
0 commit comments