logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Begun, Yana" <YBe...@nds.com>
Subject RE: 2 FileAppenders with the same file name
Date Wed, 07 Nov 2007 14:00:24 GMT
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.


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

View raw message