From 629ed629839148480f60f0045086cd5561e2c3c7 Mon Sep 17 00:00:00 2001
From: Qiang Xue <qiang.xue@gmail.com>
Date: Thu, 10 Apr 2014 08:45:33 -0400
Subject: [PATCH] start debug logging only if debug runs when bootstrap.

---
 extensions/debug/Module.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/extensions/debug/Module.php b/extensions/debug/Module.php
index e02c3df..6a61ebe 100644
--- a/extensions/debug/Module.php
+++ b/extensions/debug/Module.php
@@ -71,8 +71,8 @@ class Module extends \yii\base\Module implements BootstrapInterface
     public function init()
     {
         parent::init();
+
         $this->dataPath = Yii::getAlias($this->dataPath);
-        $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
 
         // merge custom panels and core panels so that they are ordered mainly by custom panels
         if (empty($this->panels)) {
@@ -99,6 +99,8 @@ class Module extends \yii\base\Module implements BootstrapInterface
      */
     public function bootstrap($app)
     {
+        $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
+
         // delay attaching event handler to the view component after it is fully configured
         $app->on(Application::EVENT_BEFORE_REQUEST, function () use ($app) {
             $app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
--
libgit2 0.27.1