You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Wade Chandler <wc...@redesetgrow.com> on 2004/06/11 19:30:05 UTC

Setting up an appender for specific packages in Log4j.

Does anyone know if it is possible to have an appender setup to only 
output from certain packages?  I would like to be able to log to a 
seperate file for different packages in Log4j.

Thanks for any input.

Wade


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


Re: Setting up an appender for specific packages in Log4j.

Posted by José Antonio Pérez Testa <ja...@indra.es>.
In that case you only  need two appenders and the set the additivity of 
the two categories to false. Try with that:

# Appender number 1                                                     
log4j.category.com.foo.bar.mycategory=debug,APPENDER_1                  
log4j.additivity.com.foo.bar.mycategory=false                           
log4j.appender.APPENDER_1=org.apache.log4j.DailyRollingFileAppender     
log4j.appender.APPENDER_1=org.apache.log4j.RollingFileAppender          
log4j.appender.APPENDER_1.File=${logs_path}/myFile_1.log                
log4j.appender.APPENDER_1.layout=org.apache.log4j.PatternLayout         
log4j.appender.APPENDER_1.MaxBackupIndex=1                              
log4j.appender.APPENDER_1.MaxFileSize=10MB                              
log4j.appender.APPENDER_1.layout.ConversionPattern=%t %d  [%5p %c] - %m%n
                                                                        
# Appender number 1                                                     
log4j.category.com.foo.other.my_other_category=debug,APPENDER_2                                                        

log4j.additivity.com.foo.other.my_other_category=false                                                                 

log4j.appender.APPENDER_2=org.apache.log4j.DailyRollingFileAppender                                           

log4j.appender.APPENDER_2=org.apache.log4j.RollingFileAppender                                                

log4j.appender.APPENDER_2.File=${logs_path}/myFile_2.log                                                      

log4j.appender.APPENDER_2.layout=org.apache.log4j.PatternLayout                                               

log4j.appender.APPENDER_2.MaxBackupIndex=1                                                                    

log4j.appender.APPENDER_2.MaxFileSize=10MB                                                                    

log4j.appender.APPENDER_2.layout.ConversionPattern=%t %d  [%5p %c] - %m%n  


Wade Chandler wrote:

> José Antonio Pérez Testa wrote:
>
>> Do you mean to have package com.foo.bar logging to file1.log and 
>> com.foo.other logging to another file?
>>
>> Wade Chandler wrote:
>>
>>> Does anyone know if it is possible to have an appender setup to only 
>>> output from certain packages?  I would like to be able to log to a 
>>> seperate file for different packages in Log4j.
>>>
>>> Thanks for any input.
>>>
>>> Wade
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>> ------------------------------------------------------------------------------------------------------------------- 
>>
>> Este correo electrónico y, en su caso, cualquier fichero anexo al 
>> mismo, contiene información de carácter confidencial exclusivamente 
>> dirigida a su destinatario o destinatarios. Queda prohibida su 
>> divulgación, copia o distribución a terceros sin la previa 
>> autorización escrita de Indra. En el caso de haber recibido este 
>> correo electrónico por error, se ruega notificar inmediatamente esta 
>> circunstancia mediante reenvío a la dirección electrónica del remitente.
>>
>> The information in this e-mail and in any attachments is confidential 
>> and solely for the attention and use of the named addressee(s). You 
>> are hereby notified that any dissemination, distribution or copy of 
>> this communication is prohibited without the prior written consent of 
>> Indra. If you have received this communication in error, please, 
>> notify the sender by reply e-mail
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>
> That is exactly what I would like to be able to do.  Thanks for the 
> reply.
>
> Wade
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail

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


Re: Setting up an appender for specific packages in Log4j.

Posted by Wade Chandler <wc...@redesetgrow.com>.
José Antonio Pérez Testa wrote:
> Do you mean to have package com.foo.bar logging to file1.log and 
> com.foo.other logging to another file?
> 
> Wade Chandler wrote:
> 
>> Does anyone know if it is possible to have an appender setup to only 
>> output from certain packages?  I would like to be able to log to a 
>> seperate file for different packages in Log4j.
>>
>> Thanks for any input.
>>
>> Wade
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
> ------------------------------------------------------------------------------------------------------------------- 
> 
> Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
> contiene información de carácter confidencial exclusivamente dirigida a 
> su destinatario o destinatarios. Queda prohibida su divulgación, copia o 
> distribución a terceros sin la previa autorización escrita de Indra. En 
> el caso de haber recibido este correo electrónico por error, se ruega 
> notificar inmediatamente esta circunstancia mediante reenvío a la 
> dirección electrónica del remitente.
> 
> The information in this e-mail and in any attachments is confidential 
> and solely for the attention and use of the named addressee(s). You are 
> hereby notified that any dissemination, distribution or copy of this 
> communication is prohibited without the prior written consent of Indra. 
> If you have received this communication in error, please, notify the 
> sender by reply e-mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

That is exactly what I would like to be able to do.  Thanks for the reply.

Wade


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


Re: Setting up an appender for specific packages in Log4j.

Posted by José Antonio Pérez Testa <ja...@indra.es>.
Do you mean to have package com.foo.bar logging to file1.log and 
com.foo.other logging to another file?

Wade Chandler wrote:

> Does anyone know if it is possible to have an appender setup to only 
> output from certain packages?  I would like to be able to log to a 
> seperate file for different packages in Log4j.
>
> Thanks for any input.
>
> Wade
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail

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