Trace from the browser, using standard trace()


Posted on July 1st, by Mark in AIR, Flash, Tutorials. 67 comments

UPDATE (2009-01-24):
  1. Added Vista info
  2. Updated the path to flashlog.txt for Linux
  3. Split Step 4 into two steps
  4. Added optional OSX step for creating aliases
UPDATE (2007-02-09):
  1. Added Linux info
  2. Changed mm.cfg file location for Windows 2000
  3. Made corrections to Step 4
UPDATE (2006-11-17):
  1. As of Flash Player version 9,0,28,0, the default location of flashlog.txt has changed and cannot be modified
UPDATE (2006-01-19):
  1. Changed the property order in mm.cfg
    The original order would sometimes change the name of the flashlog on mac.
  2. Changed MaxWarnings from 100 to 0
    This allows an unlimited number of error messages to be written to the flashlog.
  3. Changed which tail software I recommend for Windows
    I have settled on the tail that is included with Windows Server 2003 Resource Kit Tools.
    It’s native to Windows, easier to install than cygwin, and more stable than Tail XP.

Some great 3rd party debug tools have been released in the past few months that expand upon the standard trace() in Flash. I recently wrote about one of them. Unfortunately, I’ve noticed myself not using these tools as often as I would like because its usually easier and quicker to just use trace(). The biggest drawback about trace, however, is that there’s no way to output from the browser … or is there?

The other day I stumbled upon an article by Josh Buhler at actionscript.org that shows you how to install the Flash Debug Player that’s buried in the application folders of Flash. The Debug Player, along with a text file, allows you to view standard traces from a swf in the browser. Now, if you’ve already read his article skip on down to the bottom of this page because I’ve added a step that will make you even happier. If you haven’t read his article yet, go on what are you waiting for? If, on the other hand, you like step-by-step instructions that get you up and running the fastest, I’ve recapped his process below. I’ve done this on both the mac and pc and can’t live without it now.

  1. Uninstall your Flash Player
    Find the uninstaller here:
    Adobe Flash Player Uninstallers.
    Even though this is the first step, this is the one that you’re going to question the most, should I really uninstall my Flash Player and install the Debug Player? The answer is an emphatic “yes”. The Flash Debug Player is the exact same player with a very nice extra feature.
  2. Install the Flash Debug Player
    Find the installer here:
    Adobe Flash Debug Players
  3. Verify installation of the Flash Debug Player
    Restart your browser and right-click (ctrl-click) on a swf.
    You should have the “Debugger” option in the context menu, like the example below.
    Debugger
  4. Create a text file named “mm.cfg” and save it here:

    • OSX
      MacHD:Library:Application Support:Macromedia:mm.cfg
    • Windows Vista
      C:\Users\username\mm.cfg
    • Windows XP
      C:\Documents and Settings\username\mm.cfg
    • Windows 2000
      C:\mm.cfg
    • Linux
      home/username/mm.cfg
  5. Add the following properties to mm.cfg

    • ErrorReportingEnable=0
    • TraceOutputFileEnable=1
    • MaxWarnings=0

    FLASH DEBUG PLAYERS 9,0,28,0 AND NEWER

    The property TraceOutputFileName is no longer needed in mm.cfg. The default location of flashlog.txt has changed and cannot be modified from the following locations:

    • OSX
      MacHD:Users:username:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt
    • Windows Vista
      C:\Users\username\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt
    • Windows XP and 2000
      C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
    • Linux
      home/username/.macromedia/Flash_Player/Logs/flashlog.txt

    FLASH DEBUG PLAYERS 9,0,16,0 AND OLDER

    Add the property TraceOutputFileName to mm.cfg

    • OSX
      TraceOutputFileName=MacHD:Users:username :D esktop:flashlog.txt
    • Windows
      TraceOutputFileName=C:\Documents and Settings\username\Desktop\flashlog.txt
  6. Test the Flash Debug Player
    Restart your browser and either publish a swf that uses trace() and view it in the browser, or surf around and find out what other people have been tracing in their movies (that’s one of my favorite options).
    The traces have been output from the browser to flashlog.txt.
    Open up flashlog.txt and see for yourself, you know you want to.

And there you go.

I’m sure many of you are extremely happy right now, and you should be, this is a great tip.
But after a few uses, you’re going to get really annoyed opening and closing the text file to view the new traces … if only there was a way to view the text file being updated in real time like the Output window in Flash. Here’s the new step that will make you rejoice.

NEW STEP

  1. View the text file updating in real time

    • OSX

      • Open Terminal
      • At the prompt type:
        cd <path to flashlog's directory>
        tail -f flashlog.txt
    • Windows
      Go to Windows Server 2003 Tools, and download Windows Server 2003 Resource Kit Tools near the bottom of the page.
      Although it says Windows Server 2003 all over the page, its also made for Windows XP.

      • Install
      • Open Command Prompt
      • At the prompt type:
        cd <path to flashlog's directory>
        tail -f flashlog.txt

Browse to a swf online that uses trace() and watch the magic. Terminal and Command Prompt display the contents of flashlog.txt as it changes … its just like having Flash’s Output window, except this one works in the browser!!

Isn’t this great? Like I said earlier, I’ve gotten this to work on both the mac and the pc and can’t live without it now.
If you have any questions about these steps, feel free to email me or comment below and I’ll be glad to help.

OPTIONAL STEP

  1. Create a shortcut to quickly load up flashlog

    • OSX

      • Create aliases

        • Open Terminal
        • At the prompt type:
          cd ~
          ls -a
        • Make sure there is a file named “.bash_profile”
        • If there isn’t, create one by typing the following at the prompt:
          touch .bash_profile
        • Open .bash_profile to edit it
        • Add the following content to .bash_profile:
          alias trace='open -a /Volumes/MacHD/Applications/Utilities/Console.app/ /Users/username/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'

          alias cleartrace='cat /dev/null > /Users/username/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'
        • Save .bash_profile
        • Restart Terminal
        • To open up Console displaying the active flashlog.txt file, type the following at the prompt:
          trace
        • To clear flashlog.txt, at the prompt type:
          cleartrace
    • Windows

      1. Create a batch file

        • Create a text file and rename it flashlog.bat
        • Right-click on the batch file and select “Edit”
        • Add the following content to flashlog.bat:
          cd <path to flashlog's directory>
          tail -f flashlog.txt
        • Double-click on the batch file to see it working.
      2. Create a shortcut to the batch file to set the Command Prompt colors and options

        • Right-click on the batch file and select “Create Shortcut”
        • Right-click on the shortcut and select “Properties”
        • To view the Command Prompt maximized change the pulldown under “Run:”
        • To change the colors of the Command Prompt select the “Colors” tab
        • Unfortunately the “Font” tab options are very limited
        • Under the “Options” tab, select “QuickEdit mode” to be able to easily select and copy and paste
        • Tip for copying and pasting in the Command Prompt:
        • Select the text you want to copy and then right-click it, this puts the selected text into the clipboard … now just hit ctrl-v or paste in any other program.
        • Close out of the properties and double-click on the shortcut to see the flashlog with your colors and options.




67 thoughts on “Trace from the browser, using standard trace()

  1. Hey – glad you liked the article. I should add the info about using TailXP to it. On my Mac, I’ve actually been using Console.app to handle viewing the file. It’s in Applications > Utilities > Console.app. It’s a little easier than the Terminal. Of course, you don’t get that geek wow factor of having text constantly streaming by in your terminal though…

  2. I added these aliases to my /etc/profile file (on mac/unix). This just creates temporary aliases for the tail command and the rm command. so you just have to type “trace” in the command line to make it work. You can also use “cleartrace” to reset the flashlog.txt file. (note: all previous traces will be lost.)

    alias trace=tail\ -f\ /Users//Desktop/flashlog.txt
    alias cleartrace=rm /Users//Desktop/flashlog.txt

  3. Hi, I have followed the steps extremelly carefully but just can seem to get the falshLog.txt to be updated, no matter what…

    Are there any know issues that must be solved before taking the steps above?

    Thanks for any advice…

  4. I’m writing to ask the same question as above — I can’t get the debug version of 9 to work on my Intel Macs — has anyone had any luck with this?

  5. Right, I have the same issue. I managed to make it work in my powerpc mac but not in intel. It is a pity, it is really nice to have debugging available right from the browser…

  6. Hi there..I can’t make it work and i need this functionality..
    I follow your steps and i can’t event find the “MacHD:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt” file.ANy help, please?
    I have a mac PPC and the debug version of FP installed..
    Thanks anyway..

  7. I don’t have access to a PPC mac right now, so I might be wrong about that location. If someone could search their computer for the flashlog.txt and get back to me I’ll make the update.

    As for intel macs, I installed the Flex 2 Beta to get the Debug Player but so far no luck in finding the flashlog.txt file. Again, if anyone knows, post a comment so I can update this page.

    Thanks.

  8. Thanks for the reply..Let me get this right..A “flashlog.txt” should be in my machine after the debug player installation?Because there isn’t..

  9. Awesome article except it does not work for me. I think I have followed your steps properly.

    I am using Windows XP Pro. I have uninstalled Flash Player and then re-installed 9,0,28,0 with debug(once for IE and once for Firefox etc). I even restarted my computer when trying to set it up again. I have been running swfs that have trace in them but alas no flashlog.txt. I added a Logs folder, which was absent, and this did not help either.

    I did have Debugging Permitted in the publish settings and tried turning that off.

    I have searched the entire computer for flashlog.txt .. no luck.

    Nothing seems to work.

  10. Hey Carl,

    It definitely works, I just walked through all the steps again to make sure.
    You definitely don’t need to add a Logs folder it will be created for you in the Flash Player directory.
    Try again and see if you have better success.

  11. Excellent guide…

    Did not get it working with 9.0.28 on WinXP Pro, first, but then created the mm.cfg (without TraceOutputFileName parameter) and got my flashlog.txt

    So, it seems that step 4b is mandatory also for “FLASH DEBUG PLAYERS 9,0,28,0 AND NEWER”

  12. Great article, thanks. Really helpful and easy to follow.

    Just one further question, do you by any chance know how to automatically archive and clear the content flashlog.txt after each browser session?

  13. An additional note – it appears the only way to get the v9r28 debug player for Intel Macs is to install Flex Builder. The download link on Adobe’s page only has the PPC versions of the debug player, for some strange reason.

    Also, to add to the comments from Josh and Mims above, you can add the following lines to your .bash_profile to map the trace/cleartrace commands to use Console.app (replace the hard drive name and username in brackets with the ones for your system):

    alias trace=’open -a /Volumes/[HARD DRIVE NAME]/Applications/Utilities/Console.app/ /Users/[USERNAME]/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt’

    alias cleartrace=’cat /dev/null > /Users/[USERNAME]/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt’

    Then you can just open a terminal session and type ‘trace’ to open the trace output in Console.app, or type ‘cleartrace’ to delete everything in the log file.

  14. For the people that can’t get this to work on Win XP SP2 (and maybe other versions as well):
    Press WIN KEY+ PAUSE/BREAK (or right click My Computer and select properties).
    In the Advanced tab and click on Environment Variables.
    Under the “User variables for ” click the new button and in the prompt add:
    Variable name: “HOMEDRIVE” and the value “C:” (or the drive that windows resides on); Click Ok.
    Click New again and this time add:
    Variable Name: “HOMEPATH” value: “Documents and Settings<USERNAME>”; Yes, the value must be withought the drive and no space between “Settings” and the current username.
    After you do this, it will work.

  15. Hi
    Can you send me the Flash Debug Player download link for Intel MAC??

    I have no problem though it would be a older version of Flash Debug Player

    Thanks in Advance,
    Nirmal

  16. GOOD GOD THANK YOU! This works. The key for me was that Flash 9 now uses a default location for the log and ignores the TraceOutput whatever line in the cfg. I was PULLING MY HAIR OUT OF MY HEAD. Why they did not document this in their “why is my debug player not tracing” file I will never know.

  17. So has anyone actually got a flash trace output on and intel mac?

    I have the Intel v9.0.28 debug player and have created the mm.cfg as mentioned in the tutorials and get no flashlog.txt file created or trace output.

    I have also searched the system for copies of mm.cfg and flashlog.txt so no duplicates.

    Probably missing something obvious but I’m running out of coffee.

  18. this is great. Thank you . I think it is very helpful for me .
    In addition, This tracer tool(by wexcell) is useful for me .thanks

    Cheers from China :)

  19. Thanks for the info! FYI, the paths on Vista that worked for me are:

    create mm.cfg at: C:\Users\MyHomeDir
    log file created at: C:\Users\MyHomeDir\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt

  20. Thank you, this article fixed it for me. As I can’t find any reference to it anywhere on this page, I’ll be the first to mention Flash Tracer, a Firefox add-on which lets you view the traces in Firefox’s sidebar. Very handy!

  21. Bl4deRunner said:

    Another tip to monitor the logfile is NOTEPAD++
    http://notepad-plus.sourceforge.net/

    In settings>Preferences>MISC
    you can enable File Status Auto-detection:
    []Enable
    []Update silently

    Unfortunately it doesn’t update when the window doesn’t have a focus, but the “Find” options are second to none!

    There IS a “Doc Updater” plugin for N++, but for some reason it doesn’t work in my 64-bit WinXP… might be related to just that, so try it out:
    http://notepad-plus.sourceforge.net/uk/download.php

    And all I had to do is create a shortcut of flashlog.txt & voila!

  22. First, Thank you VERY much for this posting. I have spent a great deal of time trying to find anyway to trace flash. With your comments and links I was able to get exactly what I want.

    Second, I am running Linux Kubuntu 8.04. I downloaded the Linux standalone player from http://www.adobe.com/support/flashplayer/downloads.html
    . The package comes with a debug version of flashplayer. When I ran it for the first time it created mm.cfg in my home directory (/home/me/mm.cfg). In the mm.cfg file it lists where it is writing the flashlog.txt file (TraceOutputFileName=…). It did not let me change the flashlog.txt location. Each time I run flashplayer it replaces flashlog.txt with a new file. I use “tail -F theFileLoc/flashlog.txt” to track changes to its contents.

  23. I’ve been using this method for over a year know and want to say thanks.

    But a couple of days ago it mysteriously stopped working.
    Through what i suspect was an issue with an update to OS X possibly (though I also had a problem with my flex installation around the same time), the permissions had been set to

    -rw-r--r--

    making sure the file is set to

    $ chmod 666 flashlog.txt
    to -rw-rw-rw

    fixed it for me.

    Thanks again for the idea.

  24. Hi,

    Make sure you guys are not running any AIR application when using debug player for tracing values. It will not write flashlog.txt file. The bug is already reported to adobe. Please everyone report this issue

  25. this is the best written guide i have found to installing the Flash Debug Player. thanks to everyone who has added to the thread and mark for keeping the original post updated.

    one note: i had to reboot my mac (OS V10.5.4 running Flash Debug Player 9,0,124,0) before step 5) Test the Flash Debug Player or i would get no output in my flashlog.txt

  26. If you are only interested in the “tail.exe” and not the rest of the Windows Server 2003 Resource Kit Tools, just open “rktools.exe” with WinRAR and then open the “rktools.msi” package with WinRAR again. Copy the file tail.exe to your Windows\system32 directory.

  27. Hi there guys,

    I have been trying to get this working on an Intel Mac OSX 10.5.6 with the Debug Version of Flash Player (MAC 10,0,22,87) and it certainly doesn’t work.

    I have confirmed that the flash player is indeed the debug player, as the debugger option appears in the right-click menu.

    There is no flashlog.txt file on the computer anywhere, after trying to locate the file with spotlight and manually navigating to the location(s) described above.

    Surely there are flash developers with the latest version of OSX and the latest version of the Debug Flash Player that have this very important debugging tool working?

    Would anyone be able to offer suggestions or advice on how I can get this working?

    Regards

  28. I found why in some case the flashlog.txt is not generated. On mac, if you have a “mm.cfg” file in your user directory ( “/Users/username/mm.cfg” ) then it will discard the settings of the file located in the path described here ( “MacHD:Library:Application Support:Macromedia:mm.cfg” ).

    So make sure you don’t have a mm.cfg file in your user directory or put the same settings in it.

  29. I use Firefox and Firebug to achieve a simple debug output in the browser:

    In your Flash AS3 code:

    import flash.external.*;

    function logdebug(msg:String) {
    trace(msg); // send trace to Flash IDE
    var result:Object = ExternalInterface.call(“console.log”, msg); // send to JS firebug console
    }

    Then just add the Firebug Addon to Firefox: http://getfirebug.com/
    See also http://getfirebug.com/logging.html
    Everything you send to logdebug() will appear in the Firebug console window! Simple as that.

  30. I have my Flex builder and Flash player installed on a Win2k3 machine. When I right click on the flash (swf opened in browser) I can see ‘Debugger’. So I am sure I have the debug version of Flash.
    However I don’t have mm.cfg file anywhere in my system. So after reading this I created one with required options and values and double checked it for its correctness. I tried placing it at C:\Documents and Settings\username as well as C:\ but it doesn’t work. In fact I even tried searching for flashlog.txt but it not there anywhere in my system. Any idea what’s going wrong here?

    Uninstalling and re-installing the debug version of Flash 10 did not work. Is this supported for Win2k3? I am having this doubt since even the help doc seems to talk about only WinXP and Win2000

    -Subodh Nair

  31. This works – Thanks!
    The command prompt disappears when I close my browser window – is there any way around that?

  32. Great article! I used it many times when I forgot a step or needed a detail. Thanks for it.
    You may want to complete it with info about the policy log file, which can be very useful at times. Good info can be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Newer Comments »