<?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>Cata.printBlog(); &#187; Development</title>
	<atom:link href="http://cata.onsysol.com/blog/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://cata.onsysol.com/blog</link>
	<description>... it&#039;s about software!</description>
	<lastBuildDate>Sun, 30 May 2010 13:19:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Importance of Logging</title>
		<link>http://cata.onsysol.com/blog/2009/10/the-importance-of-logging/</link>
		<comments>http://cata.onsysol.com/blog/2009/10/the-importance-of-logging/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 19:43:25 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[logging system]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=25</guid>
		<description><![CDATA[When it comes to testing and validating the code I write, I usually do it right after I write the actual code. As much as possible I try writing very small bits of code (a function or even half a function) and then test immediately. If the input range is fairly limited (for example a [...]]]></description>
			<content:encoded><![CDATA[<p>When it comes to testing and validating the code I write, I usually do it right after I write the actual code. As much as possible I try writing very small bits of code (a function or even half a function) and then test immediately. If the input range is fairly limited (for example a function that only accepts 1 true/false parameter), you could easily check all scenarios and determine if there&#8217;s a bug or not pretty quickly. However, if you have a lot of possible inputs for the piece of code you want to test, most times you&#8217;ll test for 2-3-4 different situations and once all issues are fixed you might conclude that everything works OK. At least this is how I do it.</p>
<p>If you think unit testing might be a better solution, please stop now! In just a few words, I hate unit testing, I&#8217;ve never done it and I don&#8217;t think I ever will, unless the application I&#8217;m working on falls into one of those tiny, small and microscopic categories where unit testing actually makes sense. Writing code that validates other code that most likely will never change (at least most of it) just doesn&#8217;t make sense to me. Furthermore, in most web based applications the result of a test is actually something being displayed or rendered in a browser, so it&#8217;s much easier to just do the testing while you develop the application: write code, save, go to browser and press F5, check result and so on&#8230; quite easy!</p>
<p>Logging on the other hand is something I find truly useful. Not so much for testing, but for maintenance and debugging at a later stage. Once your application is set free into the wild, the real testing begins: scenarios you didn&#8217;t even thought were possible will start showing up and inevitably some bugs will surface. At this stage, it&#8217;s imperative and absolutely necessary for you to be able to  track down what is happening with your application.</p>
<p>I usually log almost everything. I&#8217;m using a logging system on 5 levels (below) meant to provide every bit of information about what the application is doing at any stage.</p>
<p><strong>Level 1 &#8211; Errors</strong><br />
When an error message is generated, it means the application or a specific piece of code cannot perform the action it&#8217;s supposed to do and cannot recover or find alternative solutions to complete the action.</p>
<p><strong>Level 2 &#8211; Warnings</strong><br />
Warnings are less severe error messages if you will. It means the application cannot perform a certain action, but could use an alternative solution. It could also mean that some features of the application will be disabled, but overall the application is still able to perform the action is supposed to perform.</p>
<p><strong>Level 3 &#8211; Info Messages</strong><br />
Info messages are generated whenever something non-deterministic is happening. For example, the user pressed a button or an e-mail was received.</p>
<p><strong>Level 4 &#8211; Debug Messages</strong><br />
Debug messages are generated whenever something deterministic is happening or as additional messages for Level 3 above. For example, if you have a timer to perform some action every 20 seconds, you might want to generate debug messages.</p>
<p><strong>Level 5 &#8211; Trace Messages</strong><br />
At this level I like to log everything. Basically, every function of my application will start with a trace message being generated. When this level is enabled, I can see every function call and the complete logic flow of the application. It&#8217;s very useful for tracking exactly where a problem occurs and could reduce debugging time a lot.</p>
<p>To conclude, I think logging could really save the day when it comes to debugging and maintaining a large scale application (think millions of requests/users per day). Bugs will inevitably appear and when they do, logging could make a really big difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2009/10/the-importance-of-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
