<?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/"
	>

<channel>
	<title>Web App Solution Blog &#187; logging</title>
	<atom:link href="http://www.webappsolution.com/wordpress/category/logging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webappsolution.com/wordpress</link>
	<description>When you're in need of an appsolution</description>
	<pubDate>Thu, 05 Apr 2012 19:39:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WASI AIR Logging Console v0.1.3.0 &amp; Logging Util Tools UPDATE</title>
		<link>http://www.webappsolution.com/wordpress/2010/04/26/wasi-air-logging-console-v0130-logging-util-tools-update/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/04/26/wasi-air-logging-console-v0130-logging-util-tools-update/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 21:52:50 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[air]]></category>

		<category><![CDATA[logging]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[development]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[logging-cosole]]></category>

		<category><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=812</guid>
		<description><![CDATA[Introduction
While there are several updates and changes I made to the underlying implementation, the overall functionality remains the same so please read my original post WASI AIR Logging Console &#38; Logging Util Tools for a general overview.
See It In Action!

Logging Test Application — Small test app that uses the logging framework and spits out log [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>While there are several updates and changes I made to the underlying implementation, the overall functionality remains the same so please read my original post <a href="http://www.webappsolution.com/wordpress/2010/04/13/wasi-logging-console-air-application-logging-util-tools/" target="_blank">WASI AIR Logging Console &amp; Logging Util Tools</a> for a general overview.</p>
<p><strong>See It In Action!</strong></p>
<ul>
<li><a href="http://www.webappsolution.com/air/wasi-logging-console/WASILogConsoleTest.html" target="_blank">Logging Test Application</a> — Small test app that uses the logging framework and spits out log statements every second. I have a link to the console below for quick testing.</li>
<li><a href="http://www.webappsolution.com/air/wasi-logging-console/WASILogConsole.html" target="_blank">Logging Console Test Application</a> — Allows you to see the Console in action when you run it and the Logging Test Application at the same time.</li>
</ul>
<p><strong>Assets</strong></p>
<ul>
<li><a href="http://www.webappsolution.com/air/wasi-logging-console/WASILoggingLibrary.swc">WASILoggingLibrary.swc</a> — The Log Console and Logging Utils Library</li>
<li><a href="http://www.webappsolution.com/air/wasi-logging-console/WASILogConsoleAIR.air" target="_blank">WASILogConsoleAIR.air</a> — The AIR Logging Console</li>
</ul>
<p><strong>Updates &amp; Changes</strong></p>
<ul>
<li>The name of the SWC has changed from <font color="#FF0000">WASILogConsoleLibrary.swc</font> to <font color="#339966"> WASILoggingLibrary.swc</font>.</li>
<li>The LocalConnection Logger is no longer a wrapper class, but now an actual logging target called LocalConnectionTarget.</li>
<li>Added a <a href="http://getfirebug.com/" target="_blank">Firebug</a> (FireFox extension) Logging Target that outputs the same log message as the LocalConnectionTarget.</li>
<li>Created a base WASILoggingTarget with several, common helper methods for creating targets.</li>
</ul>
<p>Since I mentioned that some of the actual impl changed a bit I&#8217;m going to show some code illustrating the changes.</p>
<p><strong>Setting Up in Main App :: Example Code</strong></p>
<p>The difference between this one and last version I shared has to do with the use of targets as opposed to a wrapper class. I also put all of my logging specifics into a helper class for the Test App called Logging &#8212; I could&#8217;ve just as easily put this all into the main app file, but I decided to move it into a new class for better organization.</p>
<pre class="brush: as3;">
&lt;mx:Application
	xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
	creationComplete=&quot;this.init()&quot;&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			import com.webappsolution.controller.FilterControllerTest;
			import com.webappsolution.delegate.FilterDelegateTest;
			import com.webappsolution.logging.Logging;

			private static var loggerSetup:* = Logging.setupLogging();

			private function init():void
			{
				var filterDelegateTest:FilterDelegateTest = new FilterDelegateTest();
				var filterControllerTest:FilterControllerTest = new FilterControllerTest();
			}

		]]&gt;
	&lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<p>The line to make note of is</p>
<pre class="brush: as3;">
private static var loggerSetup:* = Logging.setupLogging();
</pre>
<p>which calls my helper Logging class that actually creates the logging targets, levels, and filters.</p>
<p><strong>Helper Logger Class (Not Required)</strong></p>
<pre class="brush: as3;">
/**
 * Web App Solution Confidential Information
 * Copyright 2010, Web App Solution, Inc.
 *
 * @date Apr 26, 2010
 */
package com.webappsolution.logging
{
	import com.webappsolution.logging.LoggingUtils;
	import com.webappsolution.logging.target.FirebugTarget;
	import com.webappsolution.logging.target.LocalConnectionTarget;

	import mx.logging.LogEventLevel;
	import mx.logging.targets.TraceTarget;

	public class Logging
	{
		/**
		 * Create your list of targets here.
		 */
		public static function setupLogging():void
		{
			var level:int = LogEventLevel.ALL;
			var filters:Array = createFilters();
			var targets:Array = createTargets();

			// set up logging for the application
			LoggingUtils.setupLogging(level, filters, targets);
		}

		/**
		 * Create your list of compile-time filters here.
		 */
		public static function createFilters():Array
		{
			var filters:Array = [&quot;*&quot;];

			return filters;
		}

		/**
		 * Create your list of targets here.
		 */
		public static function createTargets():Array
		{
			var traceTarget:TraceTarget;
			var firebugTarget:FirebugTarget;
			var lcTarget:LocalConnectionTarget;
			var targets:Array;

			traceTarget = new TraceTarget();
			traceTarget.level = LogEventLevel.ALL;
			traceTarget.includeDate = true;
			traceTarget.includeTime = true;
			traceTarget.includeCategory = true;
			traceTarget.includeLevel = true;

			firebugTarget = new FirebugTarget();
			firebugTarget.level = LogEventLevel.ALL;
			firebugTarget.includeDate = true;
			firebugTarget.includeTime = true;
			firebugTarget.includeCategory = true;
			firebugTarget.includeLevel = true;

			lcTarget = new LocalConnectionTarget();
			lcTarget.level = LogEventLevel.ALL;
			lcTarget.includeDate = true;
			lcTarget.includeTime = true;
			lcTarget.includeCategory = true;
			lcTarget.includeLevel = true;

			// create a list of targets
			targets = [traceTarget, firebugTarget, lcTarget];

			return targets;
		}
	}
}
</pre>
<p>Here I&#8217;m just creating  the specific logging targets for my application:</p>
<ul>
<li><strong>TraceTarget</strong> &#8212; ouputs to your Flex IDE&#8217;s console</li>
<li><strong>FirebugTarget</strong> &#8212; ouputs to your FireFox&#8217;s Firebug plugin&#8217;s console</li>
<li><strong>LocalConnectionTarget</strong> &#8212; ouputs to <a href="http://www.webappsolution.com/air/wasi-logging-console/WASILogConsoleAIR.air" target="_blank">WASI AIR Logging Console</a></li>
</ul>
<p>The other change to make note of is the actual definition of the logger in each class you&#8217;re implementing logging. Let&#8217;s take a quick look here.</p>
<p><strong>New Logger Instantiation</strong></p>
<p>The <font color="#FF0000">OLD</font> way was like this:</p>
<pre class="brush: as3;">
private static const logger:ILogger = LocalConnectionLog.getLogger(FilterControllerTest);;
</pre>
<p>The <font color="#339966">NEW</font> way was like this:</p>
<pre class="brush: as3;">
private static const logger:ILogger = Log.getLogger(LoggingUtils.getFullyQualifiedClassName(FilterControllerTest));
</pre>
<p>The new design decouples the logging from our custom wrapper class <code>LocalConnectionLog</code> and now uses the out of the box <code>mx.logging.Log</code> to create a category for each logger instantiation. Notice the use of <code>LoggingUtils.getFullyQualifiedClassName(clazz:Class):String</code> to get the fully qualified string name for the object; one can also just pass in a string category of their choice instead of using the class name.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=WASI+AIR+Logging+Console+v0.1.3.0+%26+Logging+Util+Tools+UPDATE+http://kgd35.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=WASI+AIR+Logging+Console+v0.1.3.0+%26+Logging+Util+Tools+UPDATE+http://kgd35.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/04/26/wasi-air-logging-console-v0130-logging-util-tools-update/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

