关于控制台彩色日志的输出

分享 未结
0 259
梅花十三
梅花十三 1个月前
img[https://pearadmin-bbs.oss-cn-beijing.aliyuncs.com/2021/05/27/1622098401578.png] 黑白的控制台日志真让人难顶 [hr] 下面是实现控制台彩色输出的配置步骤: img[https://pearadmin-bbs.oss-cn-beijing.aliyuncs.com/2021/05/27/1622096872309.png] img[https://pearadmin-bbs.oss-cn-beijing.aliyuncs.com/2021/05/27/1622096743526.png] img[https://pearadmin-bbs.oss-cn-beijing.aliyuncs.com/2021/05/27/1622096750501.png] 1、[pre] -Dspring.output.ansi.enabled=ALWAYS [/pre] 2、[pre] output: # 彩色控制台配置 ansi: enabled: always [/pre] 3、<!-- 彩色控制台配置--> [pre] <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <pattern>${CONSOLE_LOG_PATTERN}</pattern> [/pre] 这样你的控制台就可以输出彩色的配置了。 这是因为 CONSOLE_LOG_PATTERN 这个参数是在资源 org/springframework/boot/logging/logback/defaults.xml 中定义的。 你可以访问下面的链接来查看官方的配置: a(https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml)[https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml] [hr] OK! img[https://pearadmin-bbs.oss-cn-beijing.aliyuncs.com/2021/05/27/1622098037803.png]
回帖
消灭零回复