Hello,

        Firstly, I'm a newbie to Python, but in Perl I can push my belly about a
little..
What I'd do if at all possible.

step 1. How many records (lines) will I be adding.
step 2. Open Log file
step 3. Open temporary datafile or if memory allows, store in memory(not
likely)
step 4. Skip number of lines in existing data(log) file from step 1.
step 5. write existing log file records to temp datafile
step 6. write my new records (lines) to the temp datafile (at the end of the
file)
step 7. close Log and temporary files
step 8. optionally archive exiting Log file. (for roll back option maybe)
step 9. rename temporary datafile to new Log file.
step 10.        kick feet up on desk for a few while thinking how to do this
better.

I'm sure that there are some Language features that can cut down and
eliminate steps up there but that's the basics...


Hope this helps.

Joe Youngquist


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Matt
Whiteley
Sent: Friday, April 12, 2002 7:07 AM
To: [EMAIL PROTECTED]
Subject: Log File Size Limiter


All,

I need to limit the size of a log file I'm creating. At the moment, I'm just
appending to it and it's going >100MB which is a bit excessive.

I'd like the file to 'roll' so the first entries get pushed out as the later
entries come in.

Are there any pre-written examples of this, or is there a simple way to do
it please ?

Cheers
Matt



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to