Debugging Remote Data
Although you can use the debugger to inspect data after Flex has received it and before Flex sends it, you may want to find out more details regarding what data is being sent and received. You can achieve this by using the logging framework or a data inspector.
Debugging with the Flex Logging Framework
The WebService, HTTPService, and RemoteObject components use the Flex logging
framework, which can greatly assist debugging applications. Messages
are automatically logged to the Flex logging framework, so you won’t
need to enable the components to explicitly begin logging. Messages that
are logged are within the mx.messaging.* filter. Example 18-4 is an HTTPService call with a TraceTarget that will show only log messages
related to the server calls.
Example 18-4. HTTPService call with a TraceTarget that shows log messages related to server calls
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initializeHandler()">
<mx:Script>
<![CDATA[
import mx.logging.Log;
import mx.logging.targets.TraceTarget;
private var _target:TraceTarget;
private function initializeHandler():void
{
_target = new TraceTarget();
_target.includeTime = true;
_target.includeLevel = true;
_target.includeCategory = true;
_target.filters = ["mx.messaging.*"]; Log.addTarget(_target); } private function sendToLog():void { Log.getLogger("com.oreilly.programmingflex.Logging"). info("Log Message"); } ]]> </mx:Script> <mx:Button click="sendToLog()" ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access