Hands-on practice

Report a typo

Look at this code snippet and the relevant logback.xml file and answer what the logger will output to the console.

package logback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Example {
    private static final Logger LOG = LoggerFactory.getLogger(Example.class);

    public static void main(String[] args) {
        LOG.debug("Don't worry, I'm logging.");
    }
}
<configuration>
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%msg%n</pattern>
        </encoder>
    </appender>

    <logger name="logback" level="debug">
        <appender-ref ref="stdout"/>
    </logger>
</configuration>

Pay attention both to the logger level and the encoder pattern.

Enter a short text
___

Create a free account to access the full topic