How to trace every remoting call without ServiceCapture

This isn’t a replacement for ServiceCapture; it should definately be used when you are doing some serious debugging between your client and server (or HTTPLook which isn’t as good with AMF traffic). However, if you have your own debug window, or just want another way to do it all in Flex 1.5, Flash MX 2004, and Flash 8, here’s how:

import mx.services.Log;
import mx.remoting.Service;

private static var contructedApp:Boolean = contructApp();

static function contructApp()
{
        Log.prototype.onLog = function(message:String):Void
        {
                trace(message);
        };
        _global.mainLog = new Log(Log.DEBUG, "mainLog");
        Service.prototype.log = _global.mainLog;
}

I believe that’ll show HTTPService calls for Flex 1.5 as well. Naturally, you can route trace in the onLog to whatever you want, or even use a Delegate to have the onLog function point and/or do something entirely different.

2 Replies to “How to trace every remoting call without ServiceCapture”

  1. This is nice. I got the same results by creating a class that extends mx.services.Log and then overrides the onLog function.

  2. We are looking for brilliant mid-senior level web designers with a great sense of design and execute their own production. You must have a well-developed command of flex architecture as well as action script.

Comments are closed.