Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max files in Laravel 5 logs

How can I define the maximum number of log files in Laravel 5. I use daily log rotate, and I have "only" 5 log files in storage, I want to have the past 30 days, but I don't know how to do this, and I did not found any clue.

like image 985
rap-2-h Avatar asked Mar 30 '15 14:03

rap-2-h


People also ask

Where are log files Laravel?

By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .

How do I view Laravel logs?

You can see the generated log entries in storage/logs/laravel. log file.

Can I delete Laravel log?

If you're having a space problem you can try using daily logs, it will automatically keep last X days of log (default 5). You can see it in Errors & Logging - Log Storage. Otherwise you can simply remove the storage/logs/laravel. log file or make a command to do so (like php artisane log:clear ).

What is log :: info in Laravel?

The Laravel logging facilities provide a simple layer on top of the powerful Monolog library. By default, Laravel is configured to create daily log files for your application which are stored in the storage/logs directory. You may write information to the log like so: Log::info('This is some useful information.


2 Answers

Ok, it's now possible since v5.0.23. You just need to update laravel, and add this in your config/app.php file:

'log_max_files' => 30

On Laravel 5.6 You can find config/logging.php file:

    'daily' => [
        'driver' => 'daily',
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
        'days' => 30, // 0 for unilimitted logs
    ],
like image 152
rap-2-h Avatar answered Oct 19 '22 03:10

rap-2-h


On Laravel 5.6 open file config/logging.php on array daily change: 'days' => 30

If you want unlimited logs just put 0 instead 30.

like image 9
GustavoLima Avatar answered Oct 19 '22 05:10

GustavoLima