jeudi 25 août 2016

Laravel Scheduled task doesn't append output to file

I'm running a scheduled task every 5 minutes, to do it I added this to schedule inside App\Console\Kernel

    

    $schedule->call(function(){   
        $this->bajarProveedores(); 
    })->everyFiveMinutes()
    ->appendOutputTo(storage_path('\logs\schedule.log'));

I've tried with backslash and forward slash for the file path and I used file_exists(storage_path('\logs\schedule.log')) to check if the file was there. The method runs without errors and it returns a string but nothing is appended to schedule.log, the method looks something like this:


    private function bajarProveedores()
    {
        try {
       // DO SOME STUFF HERE
        } catch (FileNotFoundException $exception)  {
        die('File: '.$filename.' error');
        }
        return 'File: '.$filename.' OK';

    }

I checked that file exists and I'm working on Windows with L5.1. Is this the right way to do it?

Any suggestions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire