SpringBootVersion: 2.3.9.RELEASE
I found that if I define logging.pattern.console
in the properties file(application.properties)
logging.pattern.console=%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
The output will look something like this
The logging.pattern.console
source is
org.springframework.boot.logging.logback.DefaultLogbackConfiguration#CONSOLE_LOG_PATTERN
This place is supposed to be a default configuration, but when I use this default configuration, there are problems
Comment From: wilkinsona
The :-
separator between a property and its default value is Logback-specific syntax. When a property is declared in application.properties
it's first processed by Spring Boot and then passed into Logback. This means that it needs to use Spring's syntax which requires just a :
between a property and its default value. This is described in section 4.4.7 of the reference documentation.