Re: Log rolling question

2005-10-26 Thread NickC
If you're on Python 2.4, then consider whether or not you can use a TimedRotatingLogFileHandler from the logging module to handle this for you: http://www.python.org/doc/2.4.1/lib/node344.html Of course, that only works if defining a "month" as 30 days is acceptable. If you genuinely need calendar

Re: Log rolling question

2005-10-25 Thread Bengt Richter
On 25 Oct 2005 10:22:24 -0700, "elake" <[EMAIL PROTECTED]> wrote: >Is there a way to do this for a whole calendar month? > Yes, if you can specify exactly what you want to do. E.g., today is 2005-10-25. What date would you like as the earliest to keep for the four months? What if today's date was

Re: Log rolling question

2005-10-25 Thread elake
Is there a way to do this for a whole calendar month? -- http://mail.python.org/mailman/listinfo/python-list

Re: Log rolling question

2005-10-25 Thread Larry Bates
import time # # 120 days, 24 hours, 60 monutes, 60 seconds # fourmonthsago=time.time()-(120*24*60*60) Compare fourmonthsago value to modified date of files. Delete those that are less. Larry Bates elake wrote: > I have an application that creates a lot of large log files. I only > want to keep

Log rolling question

2005-10-25 Thread elake
I have an application that creates a lot of large log files. I only want to keep logs for the previous 4 months. I am looking for a way to list the contents of the log dir and if the create date on the log is older than 4 months delete it. I have looked at the os.stat() function to get the created