Flex logging target on AIR

Suddenly, I felt the urge to make a cross platform panel to show Flex logging messages. I was using XPanel by Vladim Melnik from http://www.teamcti.com but that one's PC only... I kept the same LocalConnection identifier on the receiving end, so my own panel shows the same messages as with the above-mentioned XPanel as logging target. I simply & boldly named it... XPanelOnAIR :-)

Firstly, here you can download the XPanelOnAIR application (view source).
And secondly, here's a little test to demonstrate how to create logging messages that get caught by the panel (right-click, view source). As you can see, we're using Flex' built-in logging framework. This is significantly better than using trace() for example. Good thing is that you can leave your logging actions in your release versions, because you can apply log filters on type or category at application startup.

It's important to know that Vladim Melnik's XPanel completely kills all other LocalConnection communication going on and this can prevent your application from executing correctly. So if you were using that panel in the past, I strongly suggest you make the switch to XPanelOnAIR.

[UPDATE Sept. 28, 2008] Also good to know is that you can use the Flex logging framework in Flash too. Simply add the folder that points to the Flex framework in your Classpath list. Generally, the Flex framework can be found under the Flex Builder installation folder sdks/3.1.0/frameworks/projects/framework/src. Run XPanelOnAIR & check out this simple little test made in Flash. This means you can use the logging framework on the timeline too, which is cool. Download Flash sources of this sample here (.zip 33Kb).

[UPDATE March 23, 2009] In ActionScript 3 projects, you might get an error concerning a resource bundle (“Unable to resolve a class for ResourceBundle: logging.” ) when trying to use the Flex logging framework. You need to add the local/en_US/framework_rb.swc library to your ActionScript project. For more information, check out this blog post: http://www.kevin-fitzpatrick.net/blog/?p=12

This entry was posted in tools. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted September 6, 2008 at 12:22 pm | Permalink

    Nice work !
    Check out these two similar apps :
    http://code.google.com/p/flash-thunderbolt/
    http://arthropod.stopp.se/

  2. Posted September 9, 2008 at 8:03 am | Permalink

    Thank you for your comment. I know the Thunderbolt logging panel, but it didn’t work on my machine running Vista… (probably some kind of security issue ?!). On the other hand, a good thing about XPanelOnAIR is that it’s compliant with the Flex logging framework (check out the tester). The advantage of this is that you can easily register/unregister logging targets and define category filters in one place. Basically, I think it’s less code pollution.

4 Trackbacks

  1. By New features in Flex logging panel on September 11, 2008 at 10:04 pm

    [...] Flash ‘n Flex Hacks facts and findings about Flash and Flex Skip to content About me « Flex logging target on AIR [...]

  2. By Dealing with runtime errors in the Flash player on September 28, 2008 at 1:00 pm

    [...] its value sooner or later. Use Flex logging in combination with a logging target, like my own XPanelOnAIR panel. When testing your RIA, you can keep the logging panel open in parallel and check out if something [...]

  3. [...] that you can switch live between catching the log entries in the panel or writing them to a file. Read this blog post to find out how to use the application and click below to install it. addthis_url = ‘http%3A%2F%2Fwww.novio.be%2Fblog%2F%3Fp%3D920′; [...]

  4. [...] Flex logging target on AIR | by Hans Van de Velde. [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*