How to get different log level for logfile and console?

<Loggers>
    <Logger name="com.example" level="debug">
        <AppenderRef ref="File"/>
    </Logger>
    <Root level="info">
        <AppenderRef ref="Console"/>
    </Root>
</Loggers>

This outputs log level debug to both Console and File. I tried reversing the order and, although I think it does something else, adding additivity="false" to Logger. Both didn’t give me the expected result.

Where am I going wrong?

Answer

You can choose the log level with the AppenderRef tag.

<Loggers>
    <Root level="trace">
        <AppenderRef ref="Console" level="info"/>
        <AppenderRef ref="File" level="debug"/>
    </Root>
</Loggers>

Thanks to andrewjames for pointing to the relevant FAQ entry.