Re: Log Rotation, leave it to OS or do it in PHP code?

From: Date: Sat, 26 Feb 2011 13:20:34 +0000
Subject: Re: Log Rotation, leave it to OS or do it in PHP code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-311588@lists.php.net to get a copy of this message
On Sat, 2011-02-26 at 16:37 +0330, AmirBehzad Eslami wrote: > Dear list, > > It seems that Python has already a Log Rotation mechanism, > which solves the problem of log file growth. > > I'm wondering whether there is any PHP-based solution around? > Now let me ask from a different view: > > Is it a good approach to implement the Rotation mechanism to PHP? (Code Level) > Or leave the job to the operating system and other utilities? > > Where is the right place to implmenet the Rotation? In Code? In OS? > PHP? or a Bash Script? > > Thanks, > Personally, I would leave it to the OS and other tools, the reason being that it may not necessarily be the programmer who is managing the server as well. I've worked in a couple of places large enough to have dedicated server guys (and gals) who dealt with deploying managing the servers and their services. They may have a preferred way of rotating and archiving logs that is managed on all the log files, regardless of what scripting language was used to create them. If you're working in a smaller environment that doesn't have different staff supporting the servers, I would still keep the log rotation separate, but you manage this in a number of ways, either leaving it to the OS, write a bash script, PHP script, or some sort of off-the-shelf solution. I would be careful not to clutter an app too much with things it may not need to, and having the rotation dealt with independently means that it can be a utility shared by many of your scripts. Thanks, Ash http://www.ashleysheridan.co.uk

« previous php.general (#311588) next »