This is a fantastic idea.
Might I suggest a scheme that works something like the event filters that
can be added to an Appender. By this I mean that a RollingFileAppender
could have zero or 'rules' that will decide when to roll to the next file.
For example, the following 'rules' could be defined in separate classes and
selected in the config file:
1. FileSizeRule : Checks the size of the file and returns 'true' when it
reaches a configured size.
2. DateTimeRule : Checks the current or time and returns 'true' when the
date changes or when the time gets to 3:00PM for example.
3. FileExistsRule : Checks to see if the current filename exists and returns
'true' if it does.
4. SocketRule : Returns 'true' if a connection is made to the configurable
port number.
5. EventCountRule : Returns 'true' every 'n' events.
Each of the selected rules would be called with the following on each event:
1. The current filename.
2. The message text being logged.
If ANY of the 'Rules' return 'true', the RollingFileAppender would close the
current file (if open) and create/open a new file. It would then re-process
all the rules in case another roll is required.
As you would be able to configure any number of 'Rules' for the appender,
you get flexible combinations for free.
Users could also implement their own 'Rules' for rolling by deriving their
own classes from a common base class.
Ceki, If you add this functionality (or similar), can you please update the
DOMConfigurator to handle the new configurations - because that's what we
use here ;-)
Any comments, just flame away :)
Mark Douglas
Systems Union Group plc
-----Original Message-----
From: Cakalic, James P. [mailto:[EMAIL PROTECTED]]
Sent: 01 February 2001 15:44
To: 'LOG4J Developers Mailing List'
Subject: RE: New class for log4j
Actually, what I think we need is someone to sit down and design a
RollingFileAppender which can be flexibly customized to handle the various
options that seem to be recurring enhancement requests.
Possiblities:
- roll based on size
- roll based on schedule
- roll if target file exists on appender instantiation
- roll on external notification
- roll on each X number of events logged
- flexible combinations of the above
- multiple strategies for naming rolled files
Having seventeen different RollingFileAppenders in the package that each
implement some rollover algorithm implemented to address someone's specific
project needs is not an optimal solution IMHO.
Jim
> -----Original Message-----
> From: Ceki Gülcü [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ]
> Sent: Thursday, February 01, 2001 3:48 AM
> To: LOG4J Developers Mailing List
> Subject: Re: New class for log4j
>
>
> At 16:17 31.01.2001 -0700, you wrote:
> >Hi there,
> >
> >I have created a new Appender which rolls the log file at a
> >given date and time and time-stamps the old log file. How
> >should I submit it?
>
> There are two options.
>
> Option 1) (recommended)
>
> We need:
>
> - At least 3 recommendation letters.
> - A letter of motivation for contributing to this project.
> - A picture of your pet(s). You have to have at least one
> pet! Teddy bears do not qualify.
> - Social Security number to perform *casual* background checks.
> - 499.99$ in cash to cover our expenses. For faster
> processing send me the cash by postal mail.
>
> Option 2) (not recommended)
>
> - Send the code to this mailing list. :-)
>
>
> Seriously, this would be the fourth time that someone has
> implemented a date rolling appender. We really to have this
> added for 1.1. Cheers, Ceki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]