title: How do I dump variables in Yii for debugging?
body: <p>How do I dump and print variables in Yii for debugging? I would like to use <code>var_dump()</code> or <code>print_r()</code>. I tried to use <code>Yii::trace()</code> but it crashes with this error in <code>runtime/logs/app.log</code>. It doesn't even tell me the line in my code that it fails.  </p>
  
  <pre><code>2015-03-18 20:54:11 [::1][-][-][warning][yii\log\Dispatcher::dispatch] Unable to send log via yii\debug\LogTarget: Exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed'
  
  in /cygdrive/c/Users/Chloe/workspace/AffiliateArbitrage/vendor/yiisoft/yii2-debug/LogTarget.php:58
  
  Stack trace:
  #0 /cygdrive/c/Users/Chloe/workspace/AffiliateArbitrage/vendor/yiisoft/yii2-debug/LogTarget.php(58): serialize(Array)
  #1 /cygdrive/c/Users/Chloe/workspace/AffiliateArbitrage/vendor/yiisoft/yii2-debug/LogTarget.php(112): yii\debug\LogTarget-&gt;export(Array)
  #2 /cygdrive/c/Users/Chloe/workspace/AffiliateArbitrage/vendor/yiisoft/yii2/log/Dispatcher.php(183): yii\debug\LogTarget-&gt;collect(Array, true)
  #3 /cygdrive/c/Users/Chloe/workspace/AffiliateArbitrage/vendor/yiisoft/yii2/log/Logger.php(170): yii\log\Dispatcher-&gt;dispatch(Array, true)
  #4 [internal function]: yii\log\Logger-&gt;flush(true)
  #5 {main}
  </code></pre>
  
  <p>Reference
  <a href="http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html" rel="noreferrer">http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html</a></p>