logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luciano Izquierdo" <lizquie...@moviltek.com>
Subject RE: Consult
Date Thu, 08 Jan 2009 12:30:24 GMT


-----Mensaje original-----
De: Luciano Izquierdo [mailto:lizquierdo@moviltek.com] 
Enviado el: Jueves, 08 de Enero de 2009 09:25 a.m.
Para: 'Log4J Developers List'
Asunto: RE: Consult

Hi, thanks for your answer.
But your solution is if I will have only two appenders.
That does not serve me because I have more than two appenders, then if I
change the root logger, the others appenders and loggers can be broken.
I need a solution without changing de rootLogger.
My application have many loggers and appenders.

How can I do?


   

-----Mensaje original-----
De: Curt Arnold [mailto:carnold@apache.org] 
Enviado el: MiƩrcoles, 07 de Enero de 2009 03:14 p.m.
Para: Log4J Developers List
Asunto: Re: Consult


On Jan 7, 2009, at 9:27 AM, Luciano Izquierdo wrote:

> Hi, i have a problem, and i want know if somebody can i help me.
>
>
>
> I have two appenders
>
>
> Appender1
>
> And
>
> Appender2
>
>
>
> And have one logger
>
> Logger1
>
>
> I want to do, that all messege debug, info, warn, error and fatal,  
> will
> write in de appender 1.
>
> But also I want to do that only the ERROR message will write in the  
> appender
> 2.
>
> How does to do this configuration in the properties file?
>
> Plese help me!
>
>

What you want to accomplish is:

Attach both appenders to the root logger, set the level for the root  
to debug and set the threshold of appender2 to ERROR.

log4j.rootLogger=DEBUG,Appender1,Appender2
log4j.appender.Appender2.threshold=ERROR
....

The only difference from your description is that both ERROR and FATAL  
messages will go to Appender2.  If you really only wanted ERROR, you  
could apply a filter to Appender2, but that is more complicated and  
likely this solution is sufficient.

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


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


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


Mime
View raw message