Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot: CONSOLE_LOG_PATTERN_IS_UNDEFINED printed when using the logback-spring.xml from Spring documentation

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?

like image 891
chubbsondubs Avatar asked Jun 06 '26 09:06

chubbsondubs


1 Answers

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"/>
like image 80
Shawrup Avatar answered Jun 08 '26 23:06

Shawrup



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!