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 "simon_park_mail@yahoo.co.uk" <si...@yahoo.co.uk> on 2009/05/12 21:03:05 UTC

RE: Re: Alternative naming convention for renaming files using RollingFileAppender

Hi Sarat,

The TimeAndSizeRollingAppender, available for free from www.simonsite.org.uk, is a custom appender I put together to roll files by both time and by size. It adds the roll time into the backup filename and adds an index if more than one backup file is produced during the logging period. That's not quite your requirement but perhaps it might help?

This appender does some other stuff too, if configured appropriately; optionally zipping backups, removing older backup files, and forcing file rolls at the end of a logging period rather than waiting for the next log event before doing so.

HTH,

Simon

Curt Arnold wrote:
> I believe the org.apache.log4j.rolling.RollingFileAppender in the extras companion has that ability.  The org.apache.log4j.rolling.RFA are the backported RFAs from the abandoned log4j 1.3 line.
> On May 12, 2009, at 7:13 AM, sarat kumar wrote:
>> Hi all,
>> 
>> I have a question on the renaming strategy followed in the
>> RollingFileAppender in log4j. The current logic works by rolling over the
>> current file by appending the index count at the end. I was wondering if
>> there's a custom appender available which can allow me to customize the
>> renaming strategy followed while rolling over to a new file.
>> 
>> Basically, the requirement I have is that.. I need to rollover to new log
>> file if it reaches a threshold size and when I rollover, the old file should
>> be renamed with a timestamp in it. After going through the documentation I
>> figured out the daily appender does the job I want by adding timestamp at
>> the end of the file name, but it can't rollover the file based on its size.
>> I also searched in couple of forums that I know and found no fruitful
>> results.
>> 
>> Finally, I have checked the source code and figured out the 'rollover'
>> method typically hard codes logic to rollover the current file with
>> appending the index information to it. So, i guess my option is only to look
>> for third party appenders which can provide this functionality.
>> 
>> Can anyone point me to the right direction here ? if you know any third
>> party log4j appenders which can address this issue, it'd be of great help
>> for me.
>> 
>> Thanks in advance for your replies.
>> 
>> Regards,
>> Sarat kumar Beesa.
> ---------------------------------------------------------------------
> 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