Search code examples
phplaravellaravel-4log-rotation

Log Rotation in laravel 4.1


I have a project that is in laravel 4.1. My app/storage/logs/laravel.log in production has gotten huge.

I have looked around for log rotation, but could not find anything laravel 4 related. In laravel 5 there is a log option in the config/app.php which you can give values like daily etc. But I don't see any such option in laravel 4. https://github.com/laravel/laravel/blob/v4.1.0/app/config/app.php

How can i acheive log rotation in laravel 4?


Solution

  • Add following lines of code in your app/start/global.php file.

    $logFile = 'laravel.log';
    
    Log::useDailyFiles(storage_path().'/logs/'.$logFile);