Check this class:

 *  <p>CompositeRollingAppender combines
RollingFileAppender and DailyRollingFileAppender<br>
 *  It can function as either or do both at the same
time (making size
 *  based rolling files like RollingFileAppender until
a data/time boundary
 *  is crossed at which time it rolls all of those
files as per the DailyRollingFileAppender)
 *  based on the setting for
<code>rollingStyle</code>.<br>
 *  <br>
 *  To use CompositeRollingAppender to roll log files
as they reach a certain
 *  size (like RollingFileAppender), set
rollingStyle=1 (@see config.size)<br>
 *  To use CompositeRollingAppender to roll log files
at certain time intervals
 *  (daily for example), set rollingStyle=2 and a
datePattern (@see config.time)<br>
 *  To have CompositeRollingAppender roll log files at
a certain size AND rename those
 *  according to time intervals, set rollingStyle=3
(@see config.composite)<br>
 *
 *  <p>A of few additional optional features have been
added:<br>
 *  -- Attach date pattern for current log file (@see
staticLogFileName)<br>
 *  -- Backup number increments for newer files (@see
countDirection)<br>
 *  -- Infinite number of backups by file size (@see
maxSizeRollBackups)<br>
 *  <br>
 *  <p>A few notes and warnings:  For large or
infinite number of backups
 *  countDirection > 0 is highly recommended, with
staticLogFileName = false if
 *  time based rolling is also used -- this will
reduce the number of file renamings
 *  to few or none.  Changing staticLogFileName or
countDirection without clearing
 *  the directory could have nasty side effects.  If
Date/Time based rolling
 *  is enabled, CompositeRollingAppender will attempt
to roll existing files
 *  in the directory without a date/time tag based on
the last modified date
 *  of the base log files last modification.<br>
 *  <br>
 *  <p>A maximum number of backups based on date/time
boundries would be nice
 *  but is not yet implemented.<br>


U can try to write your own appender ;)

--- Martin Ritchie <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I am a long time user of log4j I the current project
> I'm working on
> has a new requirement for rotating log files. I was
> happy to see that
> this can been done by log4j.
> 
> However the two classes I saw were these:
> 
> - DailyRollingFileAppender - Rotates based on
> dateFormat
> - RollingFileAppender - Rotates based on a maximum
> file size.
> 
> What if we want both? Is this currently possible?
> 
> Cheers
> -- 
> Martin Ritchie
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to