Commit 0087339a by Qiang Xue

log fatal errors to yii logs.

parent a1251460
......@@ -170,14 +170,17 @@ abstract class ErrorHandler extends Component
if (ErrorException::isFatalError($error)) {
$exception = new ErrorException($error['message'], $error['type'], $error['type'], $error['file'], $error['line']);
$this->exception = $exception;
// use error_log because it's too late to use Yii log
// also do not log when on CLI SAPI because message will be sent to STDERR which has already been done by PHP
PHP_SAPI === 'cli' or error_log($exception);
$this->logException($exception);
if ($this->discardExistingOutput) {
$this->clearOutput();
}
$this->renderException($exception);
// need to explicitly flush logs because exit() next will terminate the app immediately
Yii::getLogger()->flush(true);
exit(1);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment