mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 07:11:19 +08:00
Fix #18120: Include path to the log file into error message if FileTarget::export
fails
This commit is contained in:
@ -19,6 +19,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #18083: Add `Controller::$request` and `$response` (brandonkelly)
|
||||
- Bug #18101: Fix behavior of OUTPUT INSERTED.* for SQL Server query: "insert default values"; correct MSSQL unit tests; turn off profiling echo message in migration test (darkdef)
|
||||
- Bug #18105: Fix for old trigger in RBAC migration with/without prefixTable (darkdef)
|
||||
- Enh #18120: Include path to the log file into error message if `FileTarget::export` fails (uaoleg)
|
||||
|
||||
|
||||
2.0.35 May 02, 2020
|
||||
|
@ -123,21 +123,21 @@ class FileTarget extends Target
|
||||
$writeResult = @file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX);
|
||||
if ($writeResult === false) {
|
||||
$error = error_get_last();
|
||||
throw new LogRuntimeException("Unable to export log through file!: {$error['message']}");
|
||||
throw new LogRuntimeException("Unable to export log through file ({$this->logFile})!: {$error['message']}");
|
||||
}
|
||||
$textSize = strlen($text);
|
||||
if ($writeResult < $textSize) {
|
||||
throw new LogRuntimeException("Unable to export whole log through file! Wrote $writeResult out of $textSize bytes.");
|
||||
throw new LogRuntimeException("Unable to export whole log through file ({$this->logFile})! Wrote $writeResult out of $textSize bytes.");
|
||||
}
|
||||
} else {
|
||||
$writeResult = @fwrite($fp, $text);
|
||||
if ($writeResult === false) {
|
||||
$error = error_get_last();
|
||||
throw new LogRuntimeException("Unable to export log through file!: {$error['message']}");
|
||||
throw new LogRuntimeException("Unable to export log through file ({$this->logFile})!: {$error['message']}");
|
||||
}
|
||||
$textSize = strlen($text);
|
||||
if ($writeResult < $textSize) {
|
||||
throw new LogRuntimeException("Unable to export whole log through file! Wrote $writeResult out of $textSize bytes.");
|
||||
throw new LogRuntimeException("Unable to export whole log through file ({$this->logFile})! Wrote $writeResult out of $textSize bytes.");
|
||||
}
|
||||
@flock($fp, LOCK_UN);
|
||||
@fclose($fp);
|
||||
|
Reference in New Issue
Block a user