title: Yii2: is it possible to filter out some query from being logged into Yii Debugger?
body: <p>I love Yii2 log system, but I'd like to 'narrow' a bit the log avoiding logging of query like </p>
  
  <pre><code>SHOW CREATE TABLE `tbl_product`
  </code></pre>
  
  <p>or RBAC-related like</p>
  
  <pre><code>SELECT * FROM `tbl_auth_assignment` WHERE `user_id`='1'
  </code></pre>
  
  <p>Where and how can I customize/configure the logging system to exclude queries <strong>by sql text</strong> (not by log category/level as usually)?</p>
  
  <p>I know I can extend FileTarget to <em>avoid some messages from being written on disk</em>. For example:</p>
  
  <pre><code>&lt;?php
  
  namespace common\components;
  
  class CustomFileTarget extends \yii\log\FileTarget
  {   
      // this is an override
      public function collect($messages, $final)
      {
  
          foreach ($messages as $index  =&gt; $message) {
              // See http://www.yiiframework.com/doc-2.0/yii-log-logger.html#$messages-detail
              if ($message[2] == 'yii\\db\\Command::query') {
  
                  $is_full_cols       = (stripos($message[0], "SHOW FULL COLUMNS")===0);
                  $is_create_table    = (stripos($message[0], "SHOW CREATE TABLE")===0);
  
                  if ($is_full_cols OR $is_create_table)  {
                      unset($messages[$index]);
                  }
              } 
  
  
          }
          parent::collect($messages, $final);
      }
  }
  </code></pre>
  
  <p>then configure my app to use it </p>
  
  <pre><code>'log'       =&gt; [
  
          'targets'   =&gt; [
              ....
              [
                  'class'         =&gt; 'common\components\CustomFileTarget',
                  'categories'    =&gt; ['*'],
              ],
          ],
  </code></pre>
  
  <p>But I'd like to AVOID these message be found in the Yii Debugger's database panel. Or, better, to <strong>complete remove logging of these SQLs at all</strong>. (Probably this need to extend active query base class)</p>
  
  <p>Doing more lookup into the Yii2 code, I found where ALL of SQLs were logged: it's in the file <code>vendor\yiisoft\yii2\db\Command.php</code> in the function <code>queryInternal</code>. I'm thinking that I should override this class to override this function, and override <code>ActiveQuery</code> and <code>ActiveRecord</code> classes to force these to use my overridden <code>Command</code> class... </p>