How to change log file path in Laravel 5 ?

In Laravel framework, they store all error store in logs file and they keep in storage folder. Logs will help to find where is error and why in details. Because in every exception it put automatically in log file. You can also put manually log like as bellow few examples:

Log::info('Info Log');

Log::alert('Alert Log');

Log::error('Error Log');

As above and there are others also available and it store on default file path "storage/logs/laravel.log".

But sometime we need to change file location or need to create our custom log for specific logs like info.log, alert.log, error.log etc then how is it possible.

As specially i required to create my custom log file during my project work and i fond way to create custom log file by using useDailyFiles() OR useFiles(). I gave you example bellow and also output.

Using useDailyFiles()

Path: storage/logs/mycustom-2017-07-07.log(current date)


Log::info('my test log');

Using useFiles()

Path: storage/logs/mycustom.log


Log::info('my test log');

You can use any one. I hope you fond your best solution....

July 7, 2017 | 134 Viewer | Category : PHP Laravel
Related Posts:

Blog Search