Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Task Scheduler Error appendOutputTo

Tags:

laravel-5.1

I added following line in Console/Kernal

protected function schedule(Schedule $schedule)
{
    $schedule->command('queue:work')
             ->everyMinute()
             ->appendOutputTo($filePath);
}

Then in cmd prompt I ran the following artisan command to run the scheduled tasks but I get following error

php artisan schedule:run

Error:

 [Symfony\Component\Debug\Exception\FatalErrorException]
 Call to undefined method Illuminate\Console\Scheduling\Event::appendOutputTo()

Where as when I use ->sendOutputTo($filename) instead it works fine, of course it doesn't append but overwrite a file.

Thanks,

K

like image 451
karmendra Avatar asked Oct 28 '15 07:10

karmendra


People also ask

How do I know if laravel Task Scheduler is running?

Well one of the way can test if Schedule is running you can dump anything to log file. Log::info('Schedule Running '. \Carbon\Carbon::now()); After that you can grep the message from Logs.

How do I schedule a cron job in laravel?

To achieve this, Cron uses the specific configuration file called 'crontab', also known as 'Cron Table', to manage the scheduling process. Cron jobs are composed of two parts, the Cron expression, and a shell command that needs to be run. Cron expression is used for setting the schedule frequency.

How does laravel scheduler work?

The scheduler allows you to fluently and expressively define your command schedule within your Laravel application itself. When using the scheduler, only a single cron entry is needed on your server. Your task schedule is defined in the app/Console/Kernel.php file's schedule method.


1 Answers

Yes, I was right, appendOutputTo() isn't present in Laravel 5.1.

Good news is it will be available in Laravel 5.2

laravel-news-5.2-whats-coming

Update: 10-Dec-2015 as sstarlight mentioned, and I rechecked (searched for appendOutputTo function), and yes it is now present in vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php unlike before. Thanks laravel and thanks sstarlight to let us know.

like image 123
karmendra Avatar answered Oct 09 '22 22:10

karmendra