Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's how I solved the same problem, but you need to abstract out the logging call it saves you typing anyway</p> <p>in your bootstrap.php</p> <pre><code>class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initLogging() { $log = new Zend_Log(); $writer_log = new Zend_Log_Writer_Stream(APPLICATION_PATH.'/../logs/'.APPLICATION_ENV.'.log'); $formatter = new Zend_Log_Formatter_Xml(); $writer_log-&gt;setFormatter($formatter); $log-&gt;addWriter($writer_log); Zend_Registry::set('logger', $log); } } </code></pre> <p>and somewhere with global scope</p> <pre><code>function debug($message, $level = Zend_Log::DEBUG) { $backtrace = debug_backtrace(); Zend_Registry::get('logger')-&gt;setEventItem('file', $backtrace[1]['file']); Zend_Registry::get('logger')-&gt;setEventItem('class', $backtrace[1]['class']); Zend_Registry::get('logger')-&gt;setEventItem('function', $backtrace[1]['function']); Zend_Registry::get('logger')-&gt;setEventItem('line', $backtrace[1]['line']); Zend_Registry::get('logger')-&gt;log($message, $level); } </code></pre> <p>the offset in the $backtrace array is to use the function above the one the called, take a look at the output of debug_backtrace if you need to look somewhere else</p> <p>it's used like this</p> <pre><code>class SomeClass { function func { debug("Message"); } } </code></pre> <p>and comes out like this (formatting added)</p> <pre><code>&lt;logEntry&gt; &lt;timestamp&gt;2010-01-01T00::00+00:00&lt;/timestamp&gt; &lt;message&gt;Message&lt;/message&gt; &lt;priority&gt;7&lt;/priority&gt; &lt;priorityName&gt;DEBUG&lt;/priorityName&gt; &lt;class&gt;SomeClass&lt;/class&gt; &lt;function&gt;func&lt;/function&gt; &lt;line&gt;2&lt;/line&gt; &lt;/logEntry&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload