PHP Log and Rotate: Write messages to log files that can be rotated

Recommend this page to a friend!
  Info   Documentation   View files (2)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 145 All time: 8,905 This week: 304
Version License PHP version Categories
logger-light 1.0MIT/X Consortium ...5.2PHP 5, Files and Folders, Logging
Description Author

This class can write messages to log files that can be rotated.

It can write messages to log files by creating the log file from the scratch or appending the new messages to the end of the file.

If a log file exceeds a given limit the class can rotate the log files by moving the old log file to another with a new name based on the current date and time.

The class can keep up to a given limit of log files in the logs directory, so older log files are deleted when the limit of log files is reached.

Picture of Alex Lushpai
  Performance   Level  
Name: Alex Lushpai is available for providing paid consulting. Contact Alex Lushpai .
Classes: 4 packages by
Country: Russian Federation Russian Federation
Age: 35
All time rank: 277276 in Russian Federation Russian Federation
Week rank: 713 24 in Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 2x



Simple class that allows you manipulate your applications logs. It can write/rewrite log files, rotate them and send data to email. Rotation enabled by default. Can be used for keep compability with php 5.2


$logger = new LoggerLight();
$logger->write('This is Log Message', '/var/www/application/logs/info.log');
$logger->rewrite(date('Y-m-d H:i:s'), '/var/www/application/logs/lastrun.log');

$logger = new LoggerLight($push = true); // enable send data via email
$logger->write('This is Alert Message', '/var/www/application/logs/error.log');
File Role Description
LoggerLight.php Class Independent logger class Doc. Readme file

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,905
This week:304

For more information send a message to info at phpclasses dot org.