Re: Rotating Log-Container

From: Date: Thu, 03 Feb 2005 14:58:51 +0000
Subject: Re: Rotating Log-Container
References: 1 2 3 4 5 6 7  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35920@lists.php.net to get a copy of this message
Hi Stephan:
Unlimited amount of logfiles? Would this make sense?
That could mean let the system do it when it needs place, if you have. But it's certlainly dangerous. Anyway, if you use only filesize, you need only to change method open() and have the attributes $maxSize, $maxFiles :) Now, one big problem subsists, you *will* have once 2 processes liking to rotate the same time. so they will concurently rename the files and result is unexpected, as a process can rename again a file just renamed by the other process :( One solution could be to rename only the current file to "xxxx.(timestamp/unique ID)" Then the only risk is to get a quite empty file (1 logging) in case of such concurence. But you will need extra listing and count of existing log files to remove the oldest if too much of them eventually. BTW: why don't you do that from a cron job, just checking log file size, rename it if necessary and remove oldest log file that are too much ? as the system do :) It would be transparent for the PHP scripts and you don't need extra archive class. -- bertrand Gugger (toggg)

« previous php.pear.dev (#35920) next »