Debugging Adobe Flex with a log file

flex logo Just found an way for debugging Adobe Flex applications which I wasn’t aware of.

If you are already creating Adobe Flex application then I assume you already use Flex Builder 3 and the debug versions of the Flash Player but what you might not be aware of is an inbuilt way of sending debug messages to a local log file – just like log.nsf.

Configure the Flash Debug Player

First you need to locate a configuration file – mm.cfg and this is dependent on which operating system you are using – if its not there then you need to create it:

Operating SystemPath
MAC OS X/Library/Application Support/Macromedia
Windows 2000 / XPC:\Documents and Settings[username]

Windows Vista / 7C:\Users[username]
Inside the file you want to set 3 properties:


Add Debug Statements to your Actionscript

In your code where you want to log output use the trace(“YOUR TEXT HERE”) method.

You must output a string and luckily most objects support a toString() method.

For complex objects or Arraycollections you can use the ObjectUtil Actionscript class which comes with the framework. e.g.


Don’t forget to import the library – mx.utils.ObjectUtil;

Locating the Log File

The location of the log file which is populated by the player depends on your operating system:

Operating SystemPath
MAC OS X/Users/[username]/Library/Preferences/Macromedia/Flash Player/Logs/
Windows 2000 / XPC:\Documents and Settings[username]

Windows Vista / 7C:\Users[username]\AppData\Roaming\Macromedia\Flash Player\Logs
#### Tailing the output

Having to keep opening that text file is a pain – luckily for window users I found a free program (with a splash screen) – BareTail.  This program will automatically keep reloading the logfile if a new entry is added, similar to a server console.