Logback Do not inherit root applications

I have a config logback where I have one logger which should not inherit the syslog application added to the root log. I can not find anywhere in the documentation how to do this.

<root level="DEBUG">
        <appender-ref ref="STDOUT" />
        <appender-ref ref="FILE" />
         <appender-ref ref="SYSLOG" />
    </root>

    <logger name="jsonlogger" level="INFO">
        <appender-ref ref="SYSLOGJSON" />
    </logger>

In this example, I do not want jsonlogger to inherit syslog appender-ref from root.

+3
source share
1 answer

Disable additivity (default is true) for your registrar:

<logger name="jsonlogger" level="INFO" additivity="false">
    <appender-ref ref="SYSLOGJSON" />
</logger>

As described in the reference guide: http://logback.qos.ch/manual/configuration.html#overrridingCumulativity

If you just want it to not have the SYSLOG application, but FILE and STDOUT, you will also need to register them in the log itself.

+6
source

All Articles