使用任务调度中的sendOutputTo
,我们可以将任务输出存储在文件中:
$schedule->command('test')->everyMinute()->sendOutputTo(storage_path('test'));
但我不想只存储最后一次执行的结果,我需要一个日志。如何将定时任务的输出记录在单个文件中?
你是不是在寻找appendOutputTo
这个函数?
$schedule->command('test')->everyMinute()->appendOutputTo(storage_path('test'));
你可以使用Laravel系统日志,
http://laravel.com/docs/5.1/errors#logging
或者你可以访问Monolog并创建自己的自定义日志。
Schedule
方法返回的Event
类中没有看到与Laravel日志记录系统相关的任何方法。 - David Harkness