You can use a logic like this
<?php
$loggerPath = "../app/logs/sql.log";
// size greater than 3 MB
if (filesize($loggerPath) > 3000000) {
// increment older log files
for ($i = 10; $i > 0; $i--) {
if (file_exists('../app/logs/sql.' . $i . '.log')) {
rename('../app/logs/sql.' . $i . '.log', '../app/logs/sql.' . ($i + 1) . '.log');
}
}
// delete eleventh file if it exists
if (file_exists('../app/logs/sql.11.log')) {
unlink('../app/logs/sql.11.log');
}
rename($loggerPath, '../app/logs/sql.1.log');
}
$logger = new FileLogger("../app/logs/sql.log", array('mode' => 'a'));
This is only a quick test implementation ;-) It will keep 10 files with max 3 MB size.