chubbsondubs
chubbsondubs

Reputation: 38885

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?

Upvotes: 6

Views: 1994

Answers (1)

Shawrup
Shawrup

Reputation: 2764

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"/>

Upvotes: 18

Related Questions