eugenp / tutorials

Just Announced - "Learn Spring Security OAuth":

Home Page:http://bit.ly/github-lsso

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typo in include resource path of logback configuration file for Setting the Log Level in Spring Boot When Testing

mejo1024 opened this issue · comments

Dear Baeldung

I have tried to configure logback as described in Setting the Log Level in Spring Boot When Testing - 4. Configuring Logback

Referring to files

Wenn I use the logback-test.xml file without the appender and root configuration, like this:

<configuration>
    <include resource="/org/springframework/boot/logging/logback/base.xml"/>
    <logger name="com.baeldung.testloglevel" level="debug"/>
</configuration>

Then I find the warning: WARN in ch.qos.logback.core.joran.action.IncludeAction - Could not find resource corresponding to [/org/springframework/boot/logging/logback/base.xml]

And the logging configuration does not work, because it does not include the resource file from spring-boot-project and because removal the appender and root configuration is missing.

I tested this with logback-classic version 1.4.14 on windows.

For me it worked to remove the trailing / of the resource path:

<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <logger name="com.baeldung.testloglevel" level="debug"/>
</configuration>

With this I can change the log level for the package com.baeldung.testloglevel and have the appender and root configuration defaults imported from spring boot.

I would suggest to fix the include resource path or remove it.

Anyway thanks for your article, it helped me to have debug messages for unit test, without needing the @SpringBootTest annotation or an application properties file.