Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加错误记录功能 #19

Closed
zacksleo opened this issue Mar 26, 2018 · 0 comments
Closed

增加错误记录功能 #19

zacksleo opened this issue Mar 26, 2018 · 0 comments

Comments

@zacksleo
Copy link
Contributor

  1. 增加一个log字段,用于记录执行过程中发的错误信息,方便查看
Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function (ErrorEvent $event) {
    if ($event->job instanceof \graychen\yii2\queue\backend\jobs\ BaseObject) {
        $model = Queue::findOne(['queue_id'=>$event->id]);
        $model->log = $event->error;
        $model->save();
    }
});
Graychen pushed a commit that referenced this issue Mar 28, 2018
zacksleo pushed a commit to zacksleo/yii2-queue-backend that referenced this issue Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant