Flex项目调试及日志记录

Debugging Flex applications with mm.cfg and flashlog.txt

When working with Flex applications, it may useful to see the output from the trace() function. Well, the good news is that if you have the debug version of the Flash Player installed, it is really easy to redirect the trace() output to an external file which can you browse using any text editor.

There are lots of excellent online resources for this already, but here is a brief run-down…

Create a file named “mm.cfg” in one of the following locations:

  • Windows; C:\Documents and Settings\username\mm.cfg
  • OSX; /Library/Application Support/Macromedia/mm.cfg
  • Linux; home/username/mm.cfg

Open the newly created mm.cfg file in a text editor and add the following text:

ErrorReportingEnable=1
TraceOutputFileEnable=1

The flashlog.txt file will be created in the following location:

  • Windows; C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
  • OSX; /Users/username/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt
  • Linux; home/username/Macromedia/Flash_Player/Logs/flashlog.txt

For more information see “Logging”, “Configuring the debugger version of Flash Player” and “Configuring the debugger version of Flash Player to record trace() output” in the Flex 2.0.1 documentation.

You can also check out the “Debugging Client-Side Code in Flex Applications” article in the adobe Flex Developer Center (although note that the article was written March, 15 2004, and some information may not be 100% accurate anymore).

If you are still having problems, check out the following adobe Technote on “Troubleshooting tips for flashlog.txt not being generated”.

For more information, check out Mark Walters’s excellent post over on digitalflipbook.com, “Trace from the browser, using standard trace()”.

Frequently Asked Questions

Q: How do I know if I have the debug version of the Flash Player already installed?
A: Finding your Flash Player version, and whether or not your Flash Player is a debug version is done by checking the version and isDebugger properties of the flash.system.Capabilities class.

Q: Where can I download a debug version of the Flash Player if I don’t have one already installed?
A: You can download nightly builds of the Flex 3 SDK from the “Adobe Labs – Flex 3 Software Development Kit” page. Simply download and extract a ZIP file, and go to the following directory: “flex_sdk_3.zip\runtimes\player”. In this folder you should find three subfolders: “lnx”, “mac”, and “win” for the Linux, Macintosh and Windows operating systems respectively. Navigate to your appropriate folder/operating system and install away!

If you have the Flex Builder 3 public beta installed, you can navigate to the following directory on a Windows system to find the various Flash Player versions (standalone, ActiveX, Mozilla): “C:\Program Files\Adobe\Flex Builder 3\sdks\moxie\runtimes\player\win”. If you don’t have the Flex Builder 3 beta installed, you can download it from “Adobe Labs – Adobe Flex Builder 3 Public Beta”.

These folder names/locations could change with any future beta/nightly build, but I’ll try and keep them updated. If you notice they are no longer correct, leave a message in the comments and I will investigate/reply.

Hopefully that about covers it. Until next time, be safe and happy Flexing!

原文地址:https://www.cnblogs.com/frogbag/p/1885380.html