报错信息如下:
Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
found character '%' that cannot start any token. (Do not use % for indentation)
in 'reader', line 12, column 16:
console: [%-5level] %d{yyyy-MM-dd HH:mm:ss ...
报错原因
yml 配置文件,提示不能以 % 开头。我的SpringBoot配置文件application.yml 内容如下。
# 指定自定义 Logger 对象日志级别
logging:
level:
top:
zyxwmj: trace
file:
# 指定日志文件存放的目录,默认的文件名为 spring.log
path: E:\
pattern:
console: [%-5level] %d{yyyy-MM-dd HH:mm:ss} %c %M %L ----- %m%n
file: [%-5level] %d{yyyy-MM-dd HH:mm:ss} %c %M %L +++++ %m%n
解决办法
首尾加上单引号(')或双引号("),如下:
# 指定自定义 Logger 对象日志级别
logging:
level:
top:
zyxwmj: trace
file:
# 指定日志文件存放的目录,默认的文件名为 spring.log
path: E:\
pattern:
console: "[%-5level] %d{yyyy-MM-dd HH:mm:ss} %c %M %L ----- %m%n"
file: '[%-5level] %d{yyyy-MM-dd HH:mm:ss} %c %M %L +++++ %m%n'
标题:Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character '%' that cannot start any token.
作者:Yi-Xing
地址:http://47.94.239.232/articles/2020/03/25/1585106882282.html
博客中若有不恰当的地方,请您一定要告诉我。前路崎岖,望我们可以互相帮助,并肩前行!