Logging Flash, Flex and AIR outside the IDE

I’ve discovered myself that logging can save a lot of time in developing an application. I’ve used initially the well known trace action, that permits to send messages to the Output Panel in Flash (or FlashDevelop) or Flex Builder IDE.
Then I’ve used some class like Out from BigSpaceShip Labs. I’ve added a call to the debug method of the Out class in all the methods of my classes, using it like this:

private function constructUI():void {
Out.info(this, "constructUI");

and having an output like this:

INFO: com.unicoshop.UnicoShop: setConnection
INFO: com.unicoshop.UnicoShop: initApplication
INFO: com.unicoshop.views.TabView: setApplicationGlobally
INFO: com.unicoshop.views.stats.StatisticheVenditeTempoReale: setConnection
INFO: com.unicoshop.views.manager.VenditaArticoli: setConnection
INFO: com.unicoshop.views.manager.ArticoliResiFornitore: setConnection
INFO: com.unicoshop.views.manager.ArticoliVenduti: setConnection

Out is powerful than the trace command, but like it doesn’t work outside of the IDE.

So I googled and I found this two great logging tools, both works in Flash and Flex projects, works under Windows, Macintosh and Linux, and both permits to log the output of Flash and Flex in a custom AIR Application (using LocalConnection to connect to the source swf or reading the flashlog.txt outputted by the debug version of the Flash Player):

  • Arthropod
    (from Lee Brimelow’s blog)
    The application is named Arthropod allows you to color-code your log messages for easy viewing. All you need to do is add their debug class to your project and use the log method instead of the usual trace command. This will be particularly useful for AIR projects created in the Flash CS3 as the trace command doesn’t work unless in debug mode.

    Usage example:

    import com.carlcalderon.arthropod.Debug;

    Debug.log(“My log message”);
    Debug.warning(“My warning message”);
    Debug.error(“My error message”);
    If you are using Arthropod to log an AIR application make sure you have checked the “insecure” option.
    This is a screenshot of my system running a Flex based AIR application, logged with Anthropod:

  • Thunderbolt
    (from the website)
    ThunderBolt is a logger extension for Flash ActionScript 2 and 3 as well as Flex 2 and 3 applications based on the Firebug add-on for Firefox.For logging without Firebug, especially for AIR applications, check out the new ThunderBolt AS3 Console. Unfortunately the Thunderbolt AS3 Console AIR application doesn’t work on Windows, due to a “limitation” of the win version of the AIR Runtime.
    Update: the problem is fixed installing the updated AIR 1.1, I’ve just tested it!

    Usage example:

    import org.osflash.thunderbolt.Logger;

    Logger.includeTime = true;


    var myNumber:int = 5;
    var myString:String = “Lorem ipsum”;

    Logger.debug(“My debug message”, myNumber, myString);
    Logger.error(“My error message”, myNumber, myString);
    Logger.info(“My info message”, myNumber, myString);
    Logger.warn(“My warning message”, myNumber, myString);
    This is a screenshot of my system running a Flex based AIR application, logged with anthropod: