When using the logback configuration in the Spring Boot documentation by putting it in a logback-spring.xml the following is printed out in the console:
CONSOLE_LOG_PATTERN_IS_UNDEFINED CONSOLE_LOG_PATTERN_IS_UNDEFINEDCONSOLE_LOG_PATTERN_IS_UNDEFINEDCONSOLE_LOG_PATTERN_IS_UNDEFINEDCONSOLE_LOG_PATTERN_IS_UNDEFINEDCONSOLE_LOG_PATTERN_IS_UNDEFINED....
That's all it prints when 1 log entry is logged. So just imagine a long line of that. The logback configuration is this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/default.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<root level="INFO">
<appender-ref ref="CONSOLE" />
</root>
<logger name="org.springframework.web" level="DEBUG"/>
</configuration>
So reading various things about this I've tried adding a <springProperty... for CONSOLE_LOG_PATTERN linked to spring.console.pattern. That didn't work. And that's what I thought default.xml is supposed to do.
So why is this suggested configuration not working?
After some digging I found this is a simple typo in the spring documentation. Here in this source you can see the file name. The file name is defaults.xml that is with a s.
But in the documentation, they are including the file as default.xml. The property CONSOLE_LOG_PATTERN is defined in the defaults.xml. Spring can not find it, so it is producing the error.
So the solution is just add an s. Change this line to
<include resource="org/springframework/boot/logging/logback/default.xml"/>
to
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With