logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: How do I turn off Root logging in Log4j2
Date Thu, 09 Jun 2016 09:28:29 GMT
Please take a look at the Architecture manual page, specifically the section on additivity.


If you set additivity=false on the Logger configuration the log message will only go to the
named logger, and not to the root logger.  

Sent from my iPhone

> On 2016/06/09, at 16:12, Richard Kolb <rjdkolb@gmail.com> wrote:
> 
> Hello,
> 
> Can someone please help me.
> I have a simple problem, that I can't solve.
> 
> With the below log4j2.xml config, all of my logging from XApp, YApp and
> FApp also get logged by the root appender as well.
> So the root logger has a duplicate log.
> 
> If I don't specify a Root logger, the logs get written to standard out.
> 
> I'm using log4j2 2.5 with the lmax disruptor 3.3.4
> 
> thanks,
> Richard.
> 
>    <Loggers>
>        <Root level="OFF">
>            <AppenderRef ref="CatchAll"/>
>        </Root>
>        <Logger name="io.r3k.log4j2test.XApp" level="trace">
>            <AppenderRef ref="Audit"/>
>        </Logger>
>        <Logger name="io.r3k.log4j2test.YApp" level="trace">
>            <AppenderRef ref="LegacyAudit"/>
>        </Logger>
>        <Logger name="io.r3k.log4j2test.FApp" level="trace">
>            <AppenderRef ref="Fault"/>
>        </Logger>
>    </Loggers>
> https://gist.github.com/rjdkolb/1201d3f54bfc409bb1b1a9e6d2bb25f5

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message