Browse Source

Fixes #1500: Log messages exported to files are not separated by newlines

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
35df318e07
  1. 1
      framework/CHANGELOG.md
  2. 5
      framework/yii/log/FileTarget.php

1
framework/CHANGELOG.md

@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #1446: Logging while logs are processed causes infinite loop (qiangxue) - Bug #1446: Logging while logs are processed causes infinite loop (qiangxue)
- Bug #1497: Localized view files are not correctly returned (mintao) - Bug #1497: Localized view files are not correctly returned (mintao)
- Bug #1500: Log messages exported to files are not separated by newlines (omnilight, qiangxue)
- Bug #1509: The SQL for creating Postgres RBAC tables is incorrect (qiangxue) - Bug #1509: The SQL for creating Postgres RBAC tables is incorrect (qiangxue)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark) - Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Enh #1293: Replaced Console::showProgress() with a better approach. See Console::startProgress() for details (cebe) - Enh #1293: Replaced Console::showProgress() with a better approach. See Console::startProgress() for details (cebe)

5
framework/yii/log/FileTarget.php

@ -83,10 +83,7 @@ class FileTarget extends Target
*/ */
public function export() public function export()
{ {
$text = ''; $text = implode("\n", array_map([$this, 'formatMessage'], $this->messages)) . "\n";
foreach ($this->messages as $message) {
$text .= $this->formatMessage($message);
}
if (($fp = @fopen($this->logFile, 'a')) === false) { if (($fp = @fopen($this->logFile, 'a')) === false) {
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}"); throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
} }

Loading…
Cancel
Save