good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: naming conventions for logsby {NULE} (Hermit) |
on Aug 05, 2002 at 18:45 UTC ( [id://187773]=note: print w/replies, xml ) | Need Help?? |
Hey aufrank,
If you don't mind a wee bit of overhead you can try running your logfile names through stftime. You can give your logfiles names like myprogram-%Y-%m-%d.log and as long as you perform your open-append each time when you go to write, and your files will be nicely broken into days for you. This will give you logfiles with names like program-2002-08-05.log (which will sort correctly) and each line will be prefixed by a HH:MM:SS timestamp. Then you could delete last month's logs with a rm *-2002-08-??.log or the like. Of course you may wish to make your logging routine a bit more sophisticated than this. (Some error checking would be nice, of course.)
Good luck,
In Section
Seekers of Perl Wisdom
|
|