To create custom Log file using Laravel, in order to track your errors or custom logs, we can use Log facade. Simply include in your controller and use it like this:

                    <?php
use Log;

class SocialAuth extends Controller
{
   public function FuncName(Request $request){

     // log something to storage/logs/laravel.log
     Log::info(['Request'=>$request]);

   }
}

?>
                  

 

If you need to save this log to a different file you can use useDailyFiles() function just before Log line:

                    <?php
use Log;

class SocialAuth extends Controller
{
   public function FuncName(Request $request){

     // log something to storage/logs/debug.log
     Log::useDailyFiles(storage_path().'/logs/debug.log');
     Log::info(['Request'=>$request]);

   }
}

?>
                  

 

The logger provides the eight logging levels defined in RFC 5424: emergency, alert, critical, error,warning, notice, info and debug:

                    Log::emergency($error);
Log::alert($error);
Log::critical($error);
Log::error($error);
Log::warning($error);
Log::notice($error);
Log::info($error);
Log::debug($error);
                  

More info in official Laravel documentation: https://laravel.com/docs/master/errors