tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Rollover for each day ? Is this possible ??
Date Fri, 19 Jan 2001 12:37:01 GMT
Since I'm partly to blame :-), my few cents:

1) I don't have any strong opinions about threads vs checking each-time. I 
guess I chose checking each time because it seemed simpler to implement.

2) "My" appender uses a configurable file format, making it possible to 
customize the file format. Through this, it's simple to have files which 
roll over every week, every month, every day of the month, every weekday, 

Since the file format maps directly to SimpleDateFormat, it ought to be 
flexible enough for most uses. If the rollover frequency changes, it is 
also possible to specify filenames which vary by the hour, or even 
(theoretically) the millisecond.


Eirik Lygre
e-vita as, Stortorvet 3, Oslo
Mobil: (+47) 905 66476
Fax: (+47) 23 35 70 51

Anders Kristensen <>
19.01.2001 13:00

        To:     LOG4J Users Mailing List <>
        Subject:        Re: Rollover for each day ? Is this possible ??

A couple of comments. JDK 1.3 comes with timer classes in
java.util.Timer and TimerTask. They don't have the functionality of cron
but that could be built on top if necessary. Using the timer
infrastructure of java.util has the advantage that fewer threads will be
created overall in a system, and also it just makes sense to use JDK
functionality when it's there. Sure some folks aren't using JDK 1.3 --
maybe there's a downloadable library that implements the java.util timer
functions like there is for the collections lib.

Also, I think that when using rolling log files one would usually like
to roll over on boundaries and not just with a certain periodicity [if
that's even a word]. For example, one might want to roll over daily at
midnight, rather than just daily at the time the server happened to be
restarted at last.


Ceki Gulcu wrote:
> Jim,
> Ooops! I got a DateRollingAppender from you too? Eirik Lygre has also 
> me one. Roberto Leong has too. Their contributions are attached.
> Jim, can you please repost your contribution on this list? I seem to 
> lost it. Sorry, I haven't been handling this item particularly well.
> What I would like to see is the following:
> 0) Keep in mind that log4j is not in the quickie business. Much of the
> success of the package can be attributed to solving problems well, not 
> solving them.
> 1) The new appender should have flexible way of expressing the rollover
> frequency, perhaps in the same format as in the Unix crontabs file which 
> belive is also a Posix standard. I am not aware of any library that
> supports this. JDring ( seems to have most
> of the functionality needed except parsing the crontab format. Anyone 
> anything better?
> As a side note, the omission of a crontab/at functionality in Java core
> libraries seems like a major oversight. Try buying stock a day later 
> what the customer ordered. See how many customers stay with your 
> house.  :-)
> 2) The new appender should not add any significant overhead to the 
> method. If appending to a file takes 100 microseconds in a particular
> environment it should still take 100 microseconds with the new appender.
> There are several possible designs. The first one is to check for the
> rollover condition at each append. This is what Eirik Lygre has done. 
> second one is to schedule a thread that will initiate the rollover after
> the appropriate delay. This is what Roberto Leong has proposed.
> The second approach seems more sound to me. One could generalize it by
> using a single timer  thread (as in JDring) to manage multiple time 
> RollingAppenders. Your opinion/comments are welcome. Ceki
> ps: I am forwarding this to the Avalon list since they are writing a
> general purpose framework.
> ps: I wonder how Tomcat addresses the issue.
> At 21:45 18.01.2001 -0500, you wrote:
> >Yes, but you need to use a different Appender than 
> >I've already written one, but haven't heard back from Ceki about adding 
> >to the "package" yet...
> >
> >-Jim Moore
> >
> >-----Original Message-----
> >From: Andrewt Tierney []
> >Sent: Thursday, January 18, 2001 8:02 PM
> >To: ''
> >Subject: Rollover for each day ? Is this possible ??
> >
> >
> >
> >I see you can set the maxsize and have it automatically rollover the 
> >file.
> >
> >Is it possible to force a new log file each day ????
> >
> >Thanks
> >Andrew
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> >For additional commands, e-mail:
> ---
> Freedom as in the capacity to exercise choice.
> ------------------------------------------------------------------------
>                              Name:
>    Type: Plain Text (text/plain)
>                          Encoding: quoted-printable
>    DailyFileAppender1.javName: DailyFileAppender1.jav
>                          Type: Plain Text (text/plain)
> ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message