Skip to content

Commit

Permalink
yii\log\Logger::flush() updated to reset messages before passing th…
Browse files Browse the repository at this point in the history
…em to the dispatcher.
  • Loading branch information
klimov-paul authored and qiangxue committed Nov 10, 2014
1 parent d82932c commit f919297
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions framework/log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ public function log($message, $level, $category = 'application')
*/
public function flush($final = false)
{
$messages = $this->messages;
$this->messages = []; // prevent processing same message twice in case flush is invoked during dispatching
if ($this->dispatcher instanceof Dispatcher) {
$this->dispatcher->dispatch($this->messages, $final);
$this->dispatcher->dispatch($messages, $final);
}
$this->messages = [];
}

/**
Expand Down

0 comments on commit f919297

Please sign in to comment.