Hi
About file-size, I just sum up the message-length using String.length(),
that's not 100% exact. As I'm not counting the bytes.
I don't think that it neccessary to read the file size from the file.
About speed I was testing WIN2k
Writing totally 45 File(s) 51.241.655 bytes
Testsuite: prantnik.test.log.TestRotatingFileOutputLogTarget
Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 22,592 sec
Testcase: testSizeRotationUniqueFilename took 1,372 sec,
writing: 18 File(s) 2.357.165 bytes
Testcase: testSizeRotationRevolingFilename took 1,202 sec
writing: 18 File(s) 2.358.725 bytes
Testcase: testTimeRotationUniqueFilename took 10,014 sec
writing: 4 File(s) 23.577.710 bytes
Testcase: testTimeRotationRevolvingFilename took 10,004 sec
writing: 4 File(s) 22.948.055 bytes
----- Originalnachricht -----
Von: "Carsten Ziegeler" <[EMAIL PROTECTED]>
Datum: Montag, August 13, 2001 4:57 pm
Betreff: AW: LogKit - FileRotation
> > Peter Donald wrote:
> >
> > On Tue, 14 Aug 2001 00:03, Carsten Ziegeler wrote:
> > > > Peter Donald wrote:
> > > >
> > > > On Mon, 13 Aug 2001 23:19, Carsten Ziegeler wrote:
> > > > > On what basis does the rotation work? File size or date?
> > > >
> > > > Both or either ;) I used an
> > > >
> > > > interface RollCondition
> > > > {
> > > > boolean roll( LogEvent event, File file );
> > > > }
> > > >
> > > > that allowed you to select the conditions under which you roll.
> > > >
> > > > > I wrote yesterday (!)
> > > >
> > > > eek ! It must be the season for it ;)
> > > >
> > > > > a simple FileTarget which combines
> > > > > both attempts, e.g. the usual rotation is done by date:
> > > > > Using a configuration a backup is created at the beginning
> > > > > of every hour, 12 hours or day. When during this period
> > > > > of time the size of the log gets to big (is also
> configurable),> > > > it is also backuped and a new log is created.
> > > > >
> > > > > Perhaps we could join forces here?
> > > >
> > > > Abvsolutely. The other thing I started to implement was an
> > interface like
> > > >
> > > > interface RollStrategy
> > > > {
> > > > File nextFile( File oldFile );
> > > > }
> > >
> > > Do you also have an interface for testing when to roll?
> >
> > Yep - see above (RollCondition) ;)
>
> Ups...
>
> So your interfaces all depend on File objects. I am not so familiar
> with the IO behaviour of Java, but I assume that you open and close
> the file each time you write something into the log, right?
> Otherwise a RollCondition which checks the file size woudn't work,
> or am I wrong here?
>
> I first implemented the target with this behaviour: opening the file,
> appending the information, closing it. But if you have turned on
> logging everything this will get soooo slow that I changed this
> into using an internal byte counter.
>
> Carsten
> >
> >
> > >
> > > Carsten
> > >
> > > > Which would do the actuall rolling. So you could select the
> > strategy with
> > > > which you name files - ie
> > > >
> > > > my.log
> > > > my.log.1
> > > > my.log.2
> > > > my.log.3
> > > > (Files after 3rd generation are deleted)
> > > >
> > > > vs
> > > >
> > > > my.log
> > > > my.log.20010722
> > > > my.log.20010611
> > > > ...
> > > > (logs are infinite and use dates to roll)
> > > >
> > > > etc.
> > > >
> > > > So you had configurable generation count (ie number of files
> that> > > could be
> > > > present), format of filename etc.
> > > >
> > > > Howeverything I did was raw and untested properly so it may be
> > > > better to work
> > > > together to get once better tested system ;)
> > > >
> > > > > Carsten
> > > > >
> > > > > Open Source Group sunShine -
> b:Integrated> > > >
> ================================================================>
> > > > Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> > > > > www.sundn.de mailto:
> [EMAIL PROTECTED]> > > >
> ================================================================>
> > > >
> > > > > > Peter Donald wrote:
> > > > > >
> > > > > > On Mon, 13 Aug 2001 22:52, Bernhard Huber wrote:
> > > > > > > Hi
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > > I was implementing a FileRotation for LogKit, but not
> using> > > > > > the very lattest LogKit interfaces.
> > > > > >
> > > > > > kool.
> > > > > >
> > > > > > > Is there a need for this feature?
> > > > > >
> > > > > > yes very much so.
> > > > > >
> > > > > > > As I understand
> > > > > > > long running server-programs will write big log files.
> > Maybe I have
> > > > > > > overseen something but FileRotation is needed in
> production> > > > > > environment, or shall Cocoon2, etc get
> restarted ever day :-) ?
> > > > > >
> > > > > > I have actually implemented FileRollTarget ages ago (a year
> > > >
> > > > or two) but I
> > > >
> > > > > > didn't own it. I actually reimplemented it a few days
> ago but
> > > > > > wasn't willing
> > > > > > to put it into CVS without more testing .. however if you
> > > >
> > > > already have a
> > > >
> > > > > > tested version .... that would be useful ;)
> > > > > >
> > > > > > Cheers,
> > > > > >
> > > > > > Pete
> > > > > >
> > > > > > *-----------------------------------------------------*
> > > > > >
> > > > > > | "Faced with the choice between changing one's mind, |
> > > > > > | and proving that there is no need to do so - almost |
> > > > > > | everyone gets busy on the proof." |
> > > > > > | - John Kenneth Galbraith |
> > > > > >
> > > > > > *-----------------------------------------------------*
> > > > > >
> > > > > >
> > -----------------------------------------------------------------
> ----
> > > > > > To unsubscribe, e-mail: avalon-dev-
> [EMAIL PROTECTED]> > > > > For additional commands, e-
> mail:
> > [EMAIL PROTECTED]
> > > > >
> > > > >
> > -----------------------------------------------------------------
> ----
> > > > > To unsubscribe, e-mail: avalon-dev-
> [EMAIL PROTECTED]> > > > For additional commands, e-
> mail: [EMAIL PROTECTED]
> > > >
> > > > --
> > > > Cheers,
> > > >
> > > > Pete
> > > >
> > > > *-----------------------------------------------------*
> > > > * "Faced with the choice between changing one's mind, *
> > > > * and proving that there is no need to do so - almost *
> > > > * everyone gets busy on the proof." *
> > > > * - John Kenneth Galbraith *
> > > > *-----------------------------------------------------*
> > > >
> > > > -------------------------------------------------------------
> --------
> > > > To unsubscribe, e-mail: avalon-dev-
> [EMAIL PROTECTED]> > > For additional commands, e-
> mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------
> ------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: avalon-dev-
> [EMAIL PROTECTED]>
> > --
> > Cheers,
> >
> > Pete
> >
> > *-----------------------------------------------------*
> > * "Faced with the choice between changing one's mind, *
> > * and proving that there is no need to do so - almost *
> > * everyone gets busy on the proof." *
> > * - John Kenneth Galbraith *
> > *-----------------------------------------------------*
> >
> > -----------------------------------------------------------------
> ----
> > 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]
>
>
begin:vcard
n:Huber;Bernhard
fn:Bernhard Huber
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]