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::useDailyFiles(storage_path().'/logs/mycustom.log');
Log::info('my test log');
Using useFiles()
Path: storage/logs/mycustom.log
Log::useFiles(storage_path().'/logs/mycustom.log');
Log::info('my test log');
You can use any one. I hope you fond your best solution....
Do you like below Tutorials ?
- PHP Laravel 5.5 - import export data into excel and csv using maatwebsite
- Laravel 7.x and 6.x create custom facade example from scratch
- Node JS - Get Real time online users counter using socket io example
- PHP Laravel 7.x and 6.x - Bootstrap Admin Theme Integration example from scratch
- MySQL Query - How to select records of today to next Sunday ?
- Laravel 7.x and 6.x - username custom validation example
- Laravel 5.5 - Import Extract zip file using chumper/zipper package
- PHP Laravel Set Custom Validation Error Messages Example