[logback-user] Some loggers do not display anything

Martial Lapeyre lapeyre.martial at gmail.com
Tue Mar 17 15:27:49 CET 2020


Hello,
I have created the following configuration

<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true">
   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%-18.18thread]
%highlight(%-5level) %-30.30logger - %msg%n</pattern>
        </encoder>
   </appender>
    <logger name="events.B" level="trace">
        <appender-ref ref="STDOUT"/>
    </logger>
    <logger name="events.A" level="trace" >
        <appender-ref ref="STDOUT"/>
    </logger>
    <root level="info"/>
</configuration>

When i use the following main

public static void main(String[] args) throws InterruptedException {
    Logger loggerA = LoggerFactory.getLogger("events.A");
    Logger loggerB = LoggerFactory.getLogger("events.B");
    loggerA.trace("I am A");
    loggerB.trace("I am B");
    Thread.sleep(1000);
}

It displays only
15:22:11.746 [main              ] TRACE events.A                       - I
am A

Process finished with exit code 0
I do not understand why the entry from the second logger is not displayed
Note: I use the system property logback.configurationFile for setting the
configuration file.

Thank you for your help.


-- 
Martial Lapeyre
Courriel: lapeyre.martial at gmail.com
Tél: 06.75.15.31.72
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20200317/77696f6a/attachment.html>


More information about the logback-user mailing list