<?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>The Integration Engineer &#187; Logging</title>
	<atom:link href="http://www.theintegrationengineer.com/category/data/logging-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.theintegrationengineer.com</link>
	<description>When it just has to work.</description>
	<lastBuildDate>Fri, 03 Feb 2012 00:21:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Perl Tricks &#8211; When errors happen</title>
		<link>http://www.theintegrationengineer.com/perl-tricks-when-errors-happen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=perl-tricks-when-errors-happen</link>
		<comments>http://www.theintegrationengineer.com/perl-tricks-when-errors-happen/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 15:03:08 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Logging]]></category>
		<category><![CDATA[PerlTips]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[error messages]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=1071</guid>
		<description><![CDATA[Back in the day, I used to use a program called Windows made by a little company called Microsoft.  I liked windows, and for the most part it did what I needed it to do.  But it also had a nasty habit of crashing when I tried to do something complex.  And this was really [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.theintegrationengineer.com/wp-content/uploads/2009/08/monitoring_pzl.jpg"><img class="alignleft size-thumbnail wp-image-596" title="monitoring_pzl" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/08/monitoring_pzl-150x150.jpg" alt="monitoring pzl 150x150 Perl Tricks   When errors happen" width="150" height="150" /></a>Back in the day, I used to use a program called Windows made by a little company called Microsoft.  I liked windows, and for the most part it did what I needed it to do.  But it also had a nasty habit of crashing when I tried to do something complex.  And this was really annoying.</p>
<p>Well as time went on, and I became more adept at using windows, I noticed that it tried to tell me what was wrong.  Windows was writing out a crash report.  And it had a message on the blue screen of death.  (a mostly incomprehensible message, but at least it was trying.)  And I discovered that if you looked for the error codes in Microsoft&#8217;s knowledge base, you could find the errors had corresponding articles for many of them.  (some of these articles were also incomprehensible.  )<span id="more-1071"></span></p>
<p>Well when you write an application in perl or any other language you will need to do something other than just crash when you encounter an error.  There are two views on what to do with an error condition; write the message to a log, and write the error out in a separate error message or file.</p>
<p>I guess there could be a third view, and that is to do both.</p>
<p><strong>Logging:</strong></p>
<p>Writing errors to a log, can be just part of the normal logging that you do as your application processes.  If you aren&#8217;t logging, you might want to consider it.  There is value in having a log file of what your application is doing.  In order to keep your logging coherant, I create a logging object and then just pass my log messages to it.  This way they can all have the same format with timestamps and such without having to write it out every time.</p>
<p><strong>Error Messages:</strong></p>
<p>My application is processing messages, transforming CSV and other types of files.  So when errors in processing happen, I move the files to an error directory, and I also write a special error file with them so that I don&#8217;t have to parse through the log to find it.</p>
<p><strong>Using alerts:</strong></p>
<p>Writing messages to a log and moving files to an error directory are fairly passive ways to handle errors.  A more active way to handle and error is to send an email or trigger an alert of some kind.  You can also use a monitoring technology like nagios to watch for errors, and send alerts.</p>
<p>What are ways that you have handled errors and logging?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/perl-tricks-when-errors-happen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Circular Files</title>
		<link>http://www.theintegrationengineer.com/circular-files/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=circular-files</link>
		<comments>http://www.theintegrationengineer.com/circular-files/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 21:16:08 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Logging]]></category>
		<category><![CDATA[circular file]]></category>
		<category><![CDATA[error tracking]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[round file]]></category>
		<category><![CDATA[trouble shooting]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=79</guid>
		<description><![CDATA[A circular file is not a nickname for the waste can. Circular files, sometimes called round files, are useful in some applications and support tasks.  With a normal log file or repository, the log grows as logged events are added to the log.  The obvious danger is that if the space where the log is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-92" title="circular-file" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/01/circular-file.jpg" alt="circular file Circular Files" width="86" height="99" />A <a href="http://www.thefreedictionary.com/circular+file">circular file</a> is not a nickname for the waste can. Circular files, sometimes called round files, are useful in some applications and support tasks.  With a normal log file or repository, the log grows as logged events are added to the log.  The obvious danger is that if the space where the log is located becomes saturated when the log grows to fill this space.  Many applications will shut down and refuse to restart if this happens.  For some applications, having the log write to a circular file is the answer.</p>
<p><span id="more-79"></span></p>
<h3>What is a Circular File?</h3>
<p>This is not like sending the log data to /dev/null or some other black hole.  It is a file that can&#8217;t grow beyond a specified size, but never refuses to accept new data.  This is not a paradox.  Visualizing this file like a roll of paper instead of a sheet of paper.  On the roll, there is no end, it just goes around and around.</p>
<p>Say you have a small circular file, 10 MB in our example.  Then lets say, every minute, you add 1 MB of data to your file. For 9 minutes after you make a log entry, you can see this entry in the file.  Each time it moves down on minutes worth of space on the log.  At 10+ minutes, it is gone.  The circular file has rolled over and overwritten that location with more current entry.</p>
<p>Okay, so a 10 minute log may not be that useful, and we would probably want to used a bigger size.  But the point is, that if disaster strikes, the log won&#8217;t grow like crazy and create an even bigger problem by filling up the disk.</p>
<h3>Why aren&#8217;t all logs like this?</h3>
<p>Using a circular file for a log is very useful, but if you have an error, and then the log scrolls on for long enough for the error to be lost, all you have are the symptoms not the cause.  So you have saved yourself the problem of making, &#8220;The smtp server failed, and the Web tool started logging errors that it couldn&#8217;t send emails.  People kept clicking, resend mail until the log filled up the disk, and the app died.&#8221; explanations.  But they are replaced with the, &#8220;Yes we logged the error, and then the app started logging all of the following actions and the error fell out of the log.&#8221;  followed by an explanation of what a circular file is and why this bad news is really good news.</p>
<p>Its best to use more than one logging method.  Say we have a circular log that allows us to see a week of normal activity.  Lets pretend that is 10 GB.  And we have a log that is flat, and only logs critical errors.  Now we have a way to not get clobbered by all the actions that start happening when the rain comes, and we don&#8217;t lose that original error that started the mess.</p>
<h3>Utopalog</h3>
<p>Okay, I am making this up, but here is my dream strategy.  First, we use a circular log that can be size configured on the fly.  Second we use an error database.  We have two table structures; First Occurrence, and Last Occurrence.  Just as they sound, when we have a new error, debug, whatever, it gets logged in the First and Last Occurrence tables.  But the Next time it happens, the time on the Last Occurrence table is the only thing that gets updated.</p>
<p>To use this, we periodically truncate or archive the tables.  The log is self cleaning.  We can do this each night, or on demand, or pick your own schedule.  Now when a problem occurs, we can look for errors that happened before the beginning of the log, but we won&#8217;t have a mountain of data that will crush us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/circular-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching using disk: basic

Served from: www.theintegrationengineer.com @ 2012-02-05 11:11:30 -->
