public function logException($exception)
    {
        $category = get_class($exception);
        if ($exception instanceof HttpException) {
            $category = 'yii\\web\\HttpException:' . $exception->statusCode;
        } elseif ($exception instanceof \ErrorException) {
            $category .= ':' . $exception->getSeverity();
        }
        if ($this->schedule) {
            $this->schedule->endCronSchedule(CronScheduleStatus::ERROR, (string)$exception);
            $this->schedule = null;
        }
        \Yii::error((string)$exception, $category);
    }