Commit 093f5ebd by Carsten Brandt

ensure log dispatcher gets registered with logger in all cases

fixes #2894
parent 09411463
......@@ -78,7 +78,7 @@ class Dispatcher extends Component
public function __construct($config = [])
{
if (isset($config['logger'])) {
$this->_logger = $config['logger'];
$this->setLogger($config['logger']);
unset($config['logger']);
}
// connect logger and dispatcher
......@@ -110,8 +110,7 @@ class Dispatcher extends Component
public function getLogger()
{
if ($this->_logger === null) {
$this->_logger = Yii::getLogger();
$this->_logger->dispatcher = $this;
$this->setLogger(Yii::getLogger());
}
return $this->_logger;
}
......@@ -123,6 +122,7 @@ class Dispatcher extends Component
public function setLogger($value)
{
$this->_logger = $value;
$this->_logger->dispatcher = $this;
}
/**
......
......@@ -8,6 +8,9 @@ namespace yiiunit\framework\log;
use yii\log\Logger;
use yiiunit\TestCase;
/**
* @group log
*/
class LoggerTest extends TestCase
{
......
......@@ -10,6 +10,9 @@ use yii\log\Logger;
use yii\log\Target;
use yiiunit\TestCase;
/**
* @group log
*/
class TargetTest extends TestCase
{
public static $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