Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mejo1024 opened this issue Mar 14, 2024 · 0 comments
Labels
on-jira triaged Issues reviewed by a dev and considered valid. Will be added in Jira.

Comments

@mejo1024
Copy link

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.

@apeterlic apeterlic added the triaged Issues reviewed by a dev and considered valid. Will be added in Jira. label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-jira triaged Issues reviewed by a dev and considered valid. Will be added in Jira.
Projects
None yet
Development

No branches or pull requests

3 participants