命令输出在laravel中写在哪里?

时间:2015-10-19 10:17:16

标签: laravel command laravel-5.1

我想知道laravel scheduled命令的输出在执行时写入的位置

protected function schedule(Schedule $schedule)
{
    $schedule->command('inspire')
             ->hourly();
}

1 个答案:

答案 0 :(得分:3)

默认情况下,它无处可写。 Laravel sugested Cronjob重定向控制台output to /dev/null

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

但您可以将控制台输出重定向到文件或通过电子邮件发送:

$schedule->command('foo')
         ->daily()
         ->sendOutputTo($filePath)
         ->emailOutputTo('foo@example.com');

您可以在Laravel's documentation找到更多信息。