Re: Setting different log levels to different appenders for a specific package (logger)
I don't remember if there's a simpler way to do it, but the advanced way of
doing this would be using a RoutingAppender which delegates to those two
different appender refs you have.
You can also take a look at additivity which is related to what you're
On 7 December 2017 at 06:10, Asma Zinneera Jabir <[hidden email]>
> I want package com.abc.xyz to log only ERRORs to the console and INFO and
> above to a file. How do I give the configuration in log4j2.xml for this?
> Tried doing the below but didn't work.
> <Root level="info">
> <AppenderRef ref="CONSOLE"/>
> <AppenderRef ref="LOGFILE"/>
> <Logger name="com.abc.xyz">
> <AppenderRef ref="LOGFILE" level="info"/>
> <AppenderRef ref="CONSOLE" level="error" />