Wednesday, January 14, 2009

Flash Debug Player and its Configuration

To work with Flex Builder Debugger, you need the Flash debug player. This is installed when you install Flex Builder. But, this may fail or you may upgrade Flash player independently. To determine if you have the debug player installed, you can navigate to: Version test for Adobe Flash Players. In ActionScript, you can use Capabilities.isDebugger property to test if you have the debug player installed.

Flash debug player is different from the standard Flash Player. It includes additional functionality that the standard player does not have such as:
  • Logs trace() statements (logging in the Flash debug player is turned off by default)
  • Works with Flex Builder Debugging Perspective
  • Works with the Flex Builder 3 Profiler
Using Flash debug player's run time log file (i.e., flashlog.txt) alone, you can gain lots of valuable information for your debugging. Output strings from trace() method are appended to this log file. Furthermore, the debug player exposes quite a bit Run Time Errors (RTEs). The production player will actually ignore most RTEs and carry on. This can let the user continue on without a fatal crash. But, sometimes the error can stop the Flash application in its tracks.

The debug version of Flash Player can be configured by the mm.cfg text file in the system. You can use any text editor to create it. The following table lists the properties that you can set in the mm.cfg file:


























Property
Description
ErrorReportingEnable

Enables the logging of error messages.


Set the ErrorReportingEnable property to 1 to enable the debugger version of Flash Player to write error messages to the log file. To disable logging of error messages, set the ErrorReportingEnable property to 0.


The default value is 0.


MaxWarnings

Sets the number of warnings to log before stopping.


The default value of the MaxWarnings property is 100. After 100 messages, the debugger version of Flash Player writes a message to the file stating that further error messages will be suppressed.


Set the MaxWarnings property to override the default message limit. For example, you can set it to 500 to capture 500 error messages.


Set the MaxWarnings property to 0 to remove the limit so that all error messages are recorded.


TraceOutputFileEnable

Enables trace logging.


Set TraceOutputFileEnable to 1 to enable the debugger version of Flash Player to write trace messages to the log file. Disable trace logging by setting the TraceOutputFileEnable property to 0.


The default value is 0.


TraceOutputFileName

Note: Beginning with the Flash Player 9 Update, Flash Player ignores the TraceOutputFileName property.


Sets the location of the log file. By default, the debugger version of Flash Player writes error messages to a file named flashlog.txt, located in the same directory in which the mm.cfg file is located.


Set TraceOutputFileName to override the default name and location of the log file by specifying a new location and name in the following form: On Macintosh OS X, you should use colons to separate directories in the TraceOutputFileName path rather than slashes.


TraceOutputFileName=<fully qualified path/filename>


For example, the following sample mm.cfg file enables error reporting and trace logging:
ErrorReportingEnable=1
TraceOutputFileEnable=1

The location of mm.cfg and its log file (i.e., flashlog.txt) is determined by OS. However, you can update the log file location and name through the TraceOutputFileName property.

The following table shows where to create mm.cfg for several operating systems.





























Operating SystemCreate mm.cfg file in this directory
Macintosh OS XMacHD:Library:Application Support:macromedia:
Microsoft Windows VistaC:\Users\user_name\
Microsoft Windows 2000/XPC:\Documents and Settings\user_name\
Microsoft Windows 95/98/ME%HOMEDRIVE%\%HOMEPATH%\
Linux
/home/user_name



The following table shows the default flashlog.txt file location:
























Operating SystemLocation of flashlog.txt
Macintosh OS XMacHD:Users:user_name:Library:Preferences:Macromedia:Flash
Player:Logs:flashlog.txt
Microsoft Windows VistaC:\Users\user_name\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt
Windows 95/98/ME/2000/XP
C:\Documents and Settings\user_name\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
Linux/home/user_name/.macromedia/Flash_Player/Logs/flashlog.txt

Being a text file, there are several ways to read from the log file:
  • Notepad or its equivalent
  • Tail or some variant
  • FlashTracer
  • Using the tail view in Aptana
If you have trouble of generating flashlog.txt log file, check out this article--"Troubleshooting tips for .txt not being generated."

No comments: