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:[email protected]] 
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: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to