8.2. Debugging

Unlike testing, debugging is an activity that starts after the code is ready and compiled to run. Debugging starts with monitoring and logging at runtime to troubleshooting as the problems emerge in a program's behavior.

The simplest and the most important starting point for debugging is the logging of operations. You can start to understand and troubleshoot problematic behavior only after you know what is going on.

8.2.1. Logging

Flex and BlazeDS applications have the advantage and flexibility of logging the operations both on the client and on the server side. In this section, I will cover client side logging first and then explain server-side logging.

8.2.1.1. Client-Side Logging

You can log all client-side interactions to a file locally on your computer. The Flash debug player has two primary ways of logging:

  • Trace method — The global trace method writes log messages to a file. Log messages are written as strings.

  • Logging API — This provides an abstraction on top of the global trace method, allowing greater control and definition of custom log targets for client-side log messages.

By default, the global trace method's output is written to a file called flashlog.txt, which resides in the Macromedia/Flash Player/Logs folder. This Macromedia folder, along with its subfolders, resides in a location that depends on your operating system. Platform-wise the location will be like so:

  • WindowsC:\Documents and Settings\<username>

  • OS X/Users/<username>/Library/Preferences ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.