Log, trace, log, release, log?

Ok, this title doesn’t make sense if you haven’t read the article which goes against the concept of title, but I find it funny!

So here I was looking for a solution to the problem I think every Flash Developer most have had: I can trace fine when I am in the Flash IDE but sometimes I need to test in the browser and then I loose my traces…

Easy solution: use a logger tool like Alcon or MonsterDebugger.

Problem: it’s annoying. When you are at the point where you need the extra logger you need to find the ActionScript classes to make it work blabla.

What I want is an elegant solution that when I test locally it uses the trace and when I test in the browser it uses the logger. I was already using the snippet for trace in FlashDevelop so I thought I could make a snippet that would have this if statement and do just that. My first bump in the road was the fact that I didn’t know how to add an import statement when using a snippet at a different place in the code.

So while looking in the FlashDevelop forums I came upon FDTracer. Well it doesn’t exist anymore, it was a pluggin before but it is now an integral part of FlashDevelop. Turns out I always had it under my nose but I never knew about it. It would be nice if in the interface they actually tell what it is and how to use it.

So here are a couple of pictures to show you where that logger is. In FlashDevelop, under View it is called Flash Log Viewer and is by default one of the tab at the bottom of the program:

What this thing does is that it reads the logs that the Flash Player writes on the computer. You see, when you put the final swf on the server and the user plays it in his browser, all of your trace statements are written in the log file. That is why leaving trace statement in your final release is not that good for performance. Anyway one last thing to know is that you actually have to start it before it works. So press the little play button and start seeing your trace.

What is cool with this little thing is that it will work locally and in the browser, you don’t have do to anything(execpt press play) to make it work. Also if you feel spyish you can check the trace from Flash website made by others.

So yeah, please clean your traces…

, , , , , ,

  1. #1 by Adobe Flex Tutorial - February 15th, 2010 at 18:20

    This is a nice FlashDevelop feature, really useful. i personally use (indirectly) trace() instructions and i prefer using Notepad++ to have a look at my debugging instructions while not in Flex Builder.
    It’s a simple but powerful text editor and it checks if the file was updated on the disk. It’s lightweight and you won’t need to open FD.
    If you can understand French, here is an article i wrote about it:
    http://www.flex-tutorial.fr/2010/02/15/flex-tips-afficher-facilement-les-trace-de-son-application-sans-passer-par-flex-builder-avec-notepad/

    Fabien
    http://www.flex-tutorial.fr

  2. #2 by Marco - February 15th, 2010 at 19:59

    I completely missed this. Thanks for posting :-)

    There’s a 3rd party FD plug-in for adding trace statements to your code. It’s very handy:

    http://www.flashdevelop.org/community/viewtopic.php?t=1128

  3. #3 by pete - February 16th, 2010 at 04:07

    or you could just use flash tracer (firefox plugin)
    http://www.sephiroth.it/weblog/archives/2006/10/post_1.php

  4. #4 by zedia.net - February 16th, 2010 at 11:06

    @ pete
    Ya I knew about this but what I found nice is that the logger was already in the tool that I use, no installation required plus can use the browser that I want

  5. #5 by jeff - February 16th, 2010 at 13:28

    I second the Flash Tracer idea. :)

  6. #6 by jeff - February 16th, 2010 at 13:40

    Missed your note about ‘using any browser’. I have found that if you have the debugger version installed in IE, flash tracer in Firefox would still pick up the logs… But it has been awhile since i used a pc. :)

  7. #7 by Chris Foster - February 16th, 2010 at 20:34

    Flash Tracer (since it also points to the flashlog.txt file) will happily trace output from a SWF running in IE. Granted, you still need to launch FlashTracer, but I usually run it in a separate window (click the icon next to the settings icon at bottom right) and close Firefox if I’m testing in IE.

    It also lets me setup filters to colour output, so I can have all my ‘INFO: blah’ traces in green, ‘ALERT: blah’ traces in orange and ‘ERROR: blah’ traces in red.

    Does the FD tool filter like that?

  8. #8 by Tahir Ahmed - February 17th, 2010 at 02:04

    This is indeed a handy little component.

  9. #9 by Steve - May 1st, 2010 at 00:01

    Excellent article. But for what it’s worth, with Flash Builder 4 now officially released to market, I recommend anyone from amatuer to serious about Adobe Flash/AIR development to shell out the dollars for the Premium IDE. Adobe have really rounded it all out with the profiling side of things and the future looks bright.

  10. #10 by zedia.net - May 1st, 2010 at 01:28

    Have you ever tried FlashDevelop? It has nothing to envy to FlashBuilder or FDT, it is a really professional IDE. Just wish it was on Mac too.

(will not be published)
Subscribe to comments feed
  1. No trackbacks yet.