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 ?
- Angular Use CKEditor Example Tutorial
- How to Use Multiple Select Dropdown in Laravel?
- Angular 9 Image Upload with Crop Example
- Files Upload on Button Click in PHP Dropzone Example
- PHP Dropzone Allow only One File to Upload Example
- PHP Dropzone Allow only Images to Upload Example
- PHP Dropzone Delete Uploaded File Example
- Livewire CRUD Laravel 7 Example