Commit f9192976 by Klimov Paul Committed by Qiang Xue

`yii\log\Logger::flush()` updated to reset messages before passing them to the dispatcher.

parent d82932c4
...@@ -162,10 +162,11 @@ class Logger extends Component ...@@ -162,10 +162,11 @@ class Logger extends Component
*/ */
public function flush($final = false) 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) { if ($this->dispatcher instanceof Dispatcher) {
$this->dispatcher->dispatch($this->messages, $final); $this->dispatcher->dispatch($messages, $final);
} }
$this->messages = [];
} }
/** /**
......
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