


<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learn DooPHP &#187; logging</title>
	<atom:link href="http://learn.doophp.com/tag/logging/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn.doophp.com</link>
	<description>Learn DooPHP - a high performance MVC based PHP framework</description>
	<lastBuildDate>Thu, 18 Aug 2011 19:47:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Profiling and DB Profiling with DooPHP</title>
		<link>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/</link>
		<comments>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 15:41:08 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Demos & Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db profiling]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=174</guid>
		<description><![CDATA[<p>If you have read the previous tutorial on <a href="http://learn.doophp.com/2009/12/using-doophp-logging-tools/">logging</a> you will find that <strong>profiling </strong>with DooPHP framework is relatively similar to the way you log messages.</p>
<p>Performance profiling can be used to measure the time &#38; memory needed for the specified code blocks and find out what the performance bottleneck is. Instead of calling log() you change it to<strong> beginProfile()</strong> and <strong>endProfile()</strong>. We need to mark the beginning and the end of each code block by inserting the following methods:</p>
<pre class="brush: php;">
Doo::logger()-&#62;beginProfile('block_id_here');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('block_id_here');
</pre>
<p>Code blocks need to be nested properly. A code block cannot intersect with another. It must be either at a parallel level or be completely enclosed by the other code block.</p>
<p>All of the profiled results can be organized in category, simply pass in another parameter at the end of the method beginProfile():</p>
<pre class="brush: php;">
//default category is 'application'
Doo::logger()-&#62;beginProfile('id', 'editpost');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('id');
</pre>
<p>To retrieve the profiled results, you called <strong>getProfileResult()</strong>. You have to pass in the block ID as parameter and you will get an associative array which shows you the time and memory used when processing the code block.</p>
<pre class="brush: php;">
Doo::logger()-&#62;beginProfile('block_id');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('block_id');
$result = Doo::logger()-&#62;getProfileResult('block_id');
</pre>
<p>To view the profiled results, you just have to call showLogs(). By default it will return a neatly</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using DooPHP Logging Tools</title>
		<link>http://learn.doophp.com/2009/12/using-doophp-logging-tools/</link>
		<comments>http://learn.doophp.com/2009/12/using-doophp-logging-tools/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:58:16 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Demos & Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[normal]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=154</guid>
		<description><![CDATA[<p>DooPHP comes with its own <strong>profiler and logging tool</strong> by default. The class that handle this in the framework is DooLog (<em>dooframework/app/logging/DooLog.php</em>)</p>
<p>There are a few methods in this file where you can use for profiling and logging queries or important message in your application. You can log a message by calling:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::Alert);
</pre>
<p>Or you can use the Alias methods instead of passing the log level:</p>
<pre class="brush: php;">
Doo::logger()-&#62;alert('Something fishy here!');
Doo::logger()-&#62;emerg('message...');
Doo::logger()-&#62;crit('message...');
Doo::logger()-&#62;err('message...');
Doo::logger()-&#62;warn('message...');
Doo::logger()-&#62;notice('message...');
Doo::logger()-&#62;info('message...');
Doo::logger()-&#62;trace('message...');
</pre>
<p>All of the log messages can be organized by category, simply pass in another parameter at the end of the methods:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::ALERT, 'editpost');
Doo::logger()-&#62;emerg('message...', 'editpost');
Doo::logger()-&#62;alert('message...', 'editpost');
</pre>
<p>To view the logged messages, you just have to call showLogs(). By default DooLog will return a neatly formatted XML log which can be filtered by level or category. You can get a plain text log if you need so:</p>
<pre class="brush: php;">
//display all logs
echo Doo::logger()-&#62;showLogs();

//display plain text log
echo Doo::logger()-&#62;showLogs(false);

//display only logs in category editpost
echo Doo::logger()-&#62;showLogs(true, null, 'editpost');

//display only logs in level Alert and category editpost
echo Doo::logger()-&#62;showLogs(true, DooLog::ALERT, 'editpost');
</pre>
<p>When you have to write the log messages into file, all you have to do is call writeLogs(). Similar to showLogs(), it writes the XML string to file by default.</p>
<pre class="brush: php;">

//Creates a log file</pre>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/12/using-doophp-logging-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
