FLEX Debugging your application


If you encounter errors in your applications, you can use the debugging tools to perform the following:

  • Set and manage breakpoints in your code
  • Control application execution by suspending, resuming, and terminating the application
  • Step into and over the code statements
  • Select critical variables to watch
  • Evaluate watch expressions while the application is running

Debugging Flex applications can be as simple as enabling trace() statements or as complex as stepping into a source files and running the code, one line at a time. The Flex Builder debugger and the command line debugger, fdb, let you step through and debug ActionScript files used by your Flex applications. For information on how to use the Flex Builder debugger, see Using Adobe Flex Builder 3. For more information on the command line debugger, fdb, see Building and Deploying Adobe Flex 3 Applications.

Using Flash Debug Player

To use the fdb command line debugger or the Flex Builder debugger, install and configure Flash Debug Player. To determine whether you are running the Flash Debug Player or the standard version of Flash Player, open any Flex application in Flash Player and right-click. If you see the Show Redraw Regions option, you are running Flash Debug Player. For more information about installing Flash Debug Player, see the LiveCycle Data Services ES installation instructions.

Flash Debug Player comes in ActiveX, Plug-in, and stand-alone versions for Microsoft Internet Explorer, Netscape-based browsers, and desktop applications. You can find Flash Debug Player installers in the following locations:

  • Flex Builder: install_dir/Player/os_version
  • Flex SDK: install_dir/runtimes/player/os_version/

Like the standard version of Adobe Flash Player 9, Flash Debug Player runs SWF files in a browser or on the desktop in a stand-alone player. Unlike Flash Player, the Flash Debug Player enables you to do the following:

  • Output statements and application errors to the local log file of Flash Debug Player by using the trace() method.
  • Write data services log messages to the local log file of Flash Debug Player.
  • View run-time errors (RTEs).
  • Use the fdb command line debugger.
  • Use the Flex Builder debugging tool.
  • Use the Flex Builder profiling tool.

Note: ADL logs  trace()  output from AIR applications.

Using logging to debug your application

One tool that can help in debugging is the logging mechanism. You can perform server-side and client-side logging of requests and responses.

Client-side logging

For client-side logging, you directly write messages to the log file, or configure the application to write messages generated by Flex to the log file. Flash Debug Player has two primary methods of writing messages to a log file:

  • The global trace() method. The global trace() method prints a String to the log file. Messages can contain checkpoint information to signal that your application reached a specific line of code, or the value of a variable.
  • Logging API. The logging API, implemented by the TraceTarget class, provides a layer of functionality on top of the trace() method. For example, you can use the logging API to log debug, error, and warning messages generated by Flex while applications execute.

Flash Debug Player sends logging information to the flashlog.txt file. The operating system determines the location of this file, as the following table shows:

Operating system

Location of log file

Windows 95/98/ME/2000/XP

C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs

Windows Vista

C:\Users\username\AppData\Roaming\Macromedia\Flash Player\Logs

Mac OS X

/Users/username/Library/Preferences/Macromedia/Flash Player/Logs/

Linux

/home/username/.macromedia/Flash_Player/Logs/

Use settings in the mm.cfg text file to configure Flash Debug Player for logging. If this file does not exist, you can create it when you first configure Flash Debug Player. The location of this file depends on your operating system. The following table shows where to create the mm.cfg file for several operating systems:

Operating system

Location of mm.cfg file

Mac OS X

/Library/Application Support/Macromedia

Windows 95/98/ME

%HOMEDRIVE%\%HOMEPATH%

Windows 2000/XP

C:\Documents and Settings\username

Windows Vista

C:\Users\username

Linux

/home/username


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 theErrorReportingEnable 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 theTraceOutputFileEnable property to 0.

The default value is 0.

TraceOutputFileName

Sets the location of the log file. By default, the debugger version of Flash Player writes error messages to a file named flashlog.txt.

Set TraceOutputFileName to override the default name and location of the log file by specifying a new location and name in the following form:

TraceOutputFileName=<fully qualified path/filename>

On Mac OS X, you should use colons to separate directories in the TraceOutputFileName path rather than slashes.

Note: Beginning with the Flash Player 9 Update, Flash Player ignores the TraceOutputFileName property and stores the flashlog.txt file in a hard-coded location based on operating system. For more information, see the section on log file location listed below.



The mm.cfg file contains many settings that you can use to control logging. The following sample mm.cfg file enables error reporting and trace logging:

ErrorReportingEnable=1
TraceOutputFileEnable=1

After you enable reporting and logging, call the trace() method to write a String to the flashlog.txt file, as the following example shows:

trace("Got to checkpoint 1.");

Insert the following MXML line to enable the logging of all Flex-generated debug messages to flashlog.txt:

<mx:TraceTarget loglevel="2"/>

For information about client-side logging, see Building and Deploying Adobe Flex 3 Applications.

Server-side logging

You configure server-side logging in the logging section of the services configuration file, services-config.xml. By default, output is sent to System.out.

You set the logging level to one of the following available levels:

  • All
  • Debug
  • Info
  • Warn
  • Error
  • None

You typically set the server-side logging level to Debug to log all debug messages, and also all info, warning, and error messages. The following example shows a logging configuration that uses the Debug logging level:

<logging>

<!-- You may also use flex.messaging.log.ServletLogTarget. -->
    <target class="flex.messaging.log.ConsoleTarget" level="Debug">
        <properties>
            <prefix>[Flex]</prefix>
            <includeDate>false</includeDate>
            <includeTime>false</includeTime>
            <includeLevel>false</includeLevel>
            <includeCategory>false</includeCategory>
        </properties>
        <filters>
            <pattern>Endpoint</pattern>
            <!--<pattern>Service.*</pattern>-->
            <!--<pattern>Message.*</pattern>-->
        </filters>
    </target>
</logging>

For more information, see Logging.

Measuring application performance

As part of preparing your application for final deployment, you can test its performance to look for ways to optimize it. One place to examine performance is in the message processing part of the application. To help you gather this performance information, enable the gathering of message timing and sizing data.

The mechanism for measuring the performance of message processing is disabled by default. When enabled, information regarding message size, server processing time, and network travel time is captured. This information is available to the client that pushed a message to the server, to a client that received a pushed message from the server, or to a client that received an acknowledge message from the server in response a pushed message. A subset of this information is also available for access on the server.

You can use this mechanism across all channel types, including polling and streaming channels, that communicate with the server. However, this mechanism does not work when you make a direct connection to an external server by setting the useProxy property to false for the HTTPService and WebService tags because it bypasses the LiveCycle Data Services ES Proxy Server.

You use two parameters in a channel definition to enable message processing metrics:

  • <record-message-times>
  • <record-message-sizes>

Set these parameters to true or false; the default value is false. You can set the parameters to different values to capture only one type of metric. For example, the following channel definition specifies to capture message timing information, but not message sizing information:

<channel-definition id="my-streaming-amf" 
    class="mx.messaging.channels.StreamingAMFChannel">
    <endpoint 
        url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf"             class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
    <properties>
        <record-message-times>true</record-message-times>
        <record-message-sizes>false</record-message-sizes>
    </properties>
</channel-definition>





转载地址:http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=build_apps_6.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值