You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Begun, Yana" <YB...@nds.com> on 2007/11/07 12:30:46 UTC

2 FileAppenders with the same file name

Hi,
 
I am looking to the way to use functionality of the both
DayRollingFileAppender and RollingFileAppender for the same logger. Is
it OK to create 2 different appenders with the same file name and to add
them to the same Logger?
 
Thanks,
Yana
*********************************************************************************************************
This e-mail is confidential, the property of NDS Ltd and intended for the addressee only.  Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited.  If you have received this message in error, please immediately notify the postmaster@nds.com and destroy the original message.  Messages sent to and from NDS may be monitored.  NDS cannot guarantee any message delivery method is secure or error-free.  Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.  We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission.  You should carry out your own virus checks before opening any attachment.  Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England and Wales  Registered no. 3080780   VAT no. GB 603 8808 40-00

To protect the environment please do not print this e-mail unless necessary.
**********************************************************************************************************


Re: 2 FileAppenders with the same file name

Posted by Jacob Kjome <ho...@visi.com>.
I't in the "extras" companion package, which should work with Log4j-1.2.9 or 
later (and possibly 1.2.8 as well).  See...

http://logging.apache.org/log4j/companions/extras/
http://logging.apache.org/log4j/companions/extras/download.html
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rolling/


Jake

On Wed, 7 Nov 2007 16:00:24 +0200
  "Begun, Yana" <YB...@nds.com> wrote:
> Thanks, Curt
> It looks exactly what I need (hope)
> Where I can find this  org.apache.log4j.rolling ? I downloaded
> apache-log4j-1.2.15 , but didn't find this project in it.
> 
> Yana
> 
> On Nov 7, 2007, at 5:30 AM, Begun, Yana wrote:
> 
>> Hi,
>>
>> I am looking to the way to use functionality of the both 
>> DayRollingFileAppender and RollingFileAppender for the same logger. Is
> 
>> it OK to create 2 different appenders with the same file name and to 
>> add them to the same Logger?
>>
>> Thanks,
>> Yana
>>
> 
> If the file names refer to the same physical file, then bad things  
> are likely to happen but log4j will do nothing to stop or warn you.   
> log4j makes no attempt to detect or synchronize access to a single file
> by more than one appender.  The scenario arises most frequently when the
> same configuration file is loaded into multiple JVM's.
> 
> Instead of starting from org.apache.log4j.RollingFileAppender, look at
> org.apache.log4j.rolling.RollingFileAppender in the extras companion
> which was designed with pluggable triggering policies (when to roll
> over) and rolling policies (what to name files).  It is likely that you
> can achieve your desired behavior by supplying your own policies and not
> have to extend the appender.  If it isn't obvious (or even if it is),
> ask here and we can give advice.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> *********************************************************************************************************
> This e-mail is confidential, the property of NDS Ltd and intended for the 
>addressee only.  Any dissemination, copying or distribution of this message 
>or any attachments by anyone other than the intended recipient is strictly 
>prohibited.  If you have received this message in error, please immediately 
>notify the postmaster@nds.com and destroy the original message.  Messages 
>sent to and from NDS may be monitored.  NDS cannot guarantee any message 
>delivery method is secure or error-free.  Information could be intercepted, 
>corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
> We do not accept responsibility for any errors or omissions in this message 
>and/or attachment that arise as a result of transmission.  You should carry 
>out your own virus checks before opening any attachment.  Any views or 
>opinions presented are solely those of the author and do not necessarily 
>represent those of NDS.
> 
> NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West 
>Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England 
>and Wales  Registered no. 3080780   VAT no. GB 603 8808 40-00
> 
> To protect the environment please do not print this e-mail unless necessary.
> **********************************************************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


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


RE: 2 FileAppenders with the same file name

Posted by "Begun, Yana" <YB...@nds.com>.
Thanks, Curt
It looks exactly what I need (hope)
Where I can find this  org.apache.log4j.rolling ? I downloaded
apache-log4j-1.2.15 , but didn't find this project in it.

Yana

On Nov 7, 2007, at 5:30 AM, Begun, Yana wrote:

> Hi,
>
> I am looking to the way to use functionality of the both 
> DayRollingFileAppender and RollingFileAppender for the same logger. Is

> it OK to create 2 different appenders with the same file name and to 
> add them to the same Logger?
>
> Thanks,
> Yana
>

If the file names refer to the same physical file, then bad things  
are likely to happen but log4j will do nothing to stop or warn you.   
log4j makes no attempt to detect or synchronize access to a single file
by more than one appender.  The scenario arises most frequently when the
same configuration file is loaded into multiple JVM's.

Instead of starting from org.apache.log4j.RollingFileAppender, look at
org.apache.log4j.rolling.RollingFileAppender in the extras companion
which was designed with pluggable triggering policies (when to roll
over) and rolling policies (what to name files).  It is likely that you
can achieve your desired behavior by supplying your own policies and not
have to extend the appender.  If it isn't obvious (or even if it is),
ask here and we can give advice.

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

*********************************************************************************************************
This e-mail is confidential, the property of NDS Ltd and intended for the addressee only.  Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited.  If you have received this message in error, please immediately notify the postmaster@nds.com and destroy the original message.  Messages sent to and from NDS may be monitored.  NDS cannot guarantee any message delivery method is secure or error-free.  Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.  We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission.  You should carry out your own virus checks before opening any attachment.  Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England and Wales  Registered no. 3080780   VAT no. GB 603 8808 40-00

To protect the environment please do not print this e-mail unless necessary.
**********************************************************************************************************


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


Re: 2 FileAppenders with the same file name

Posted by Curt Arnold <ca...@apache.org>.
On Nov 7, 2007, at 5:30 AM, Begun, Yana wrote:

> Hi,
>
> I am looking to the way to use functionality of the both
> DayRollingFileAppender and RollingFileAppender for the same logger. Is
> it OK to create 2 different appenders with the same file name and  
> to add
> them to the same Logger?
>
> Thanks,
> Yana
>

If the file names refer to the same physical file, then bad things  
are likely to happen but log4j will do nothing to stop or warn you.   
log4j makes no attempt to detect or synchronize access to a single  
file by more than one appender.  The scenario arises most frequently  
when the same configuration file is loaded into multiple JVM's.

Instead of starting from org.apache.log4j.RollingFileAppender, look  
at org.apache.log4j.rolling.RollingFileAppender in the extras  
companion which was designed with pluggable triggering policies (when  
to roll over) and rolling policies (what to name files).  It is  
likely that you can achieve your desired behavior by supplying your  
own policies and not have to extend the appender.  If it isn't  
obvious (or even if it is), ask here and we can give advice.

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