TraceTarget and Remoting

If you happen to use RemoteObjects in your Flex app and at the same time use TraceTarget to output your log messages, you’ll soon find that the RemoteObject floods your console with all kinds of information on each remoting request. Nice, but sometimes unwelcome.

Turning this off took me a few to figure out. I was instantiating my Log in my application’s preInitialize event:


protected function onPreInit():void
{

  //Init log
  var myLogger:ILogger = Log.getLogger("com.mcquilleninteractive.myproject")
  var traceTarget:TraceTarget = new TraceTarget()
  traceTarget.includeDate = true;
  traceTarget.includeTime = true;
  traceTarget.includeLevel = true;
  traceTarget.level = LogEventLevel.DEBUG
  traceTarget.filters = ["com.mcquilleninteractive.myproject"]
  Log.addTarget(traceTarget)
  myLogger.debug("Logger created", this)
 }

Note that I’ve given my Log destination the name

com.compositesw.monitor

. Setting this name in the traceTarget.filters should cause the console to ignore all other log messages. But…it doesn’t.

The trick, it turns out, is to use a tag rather than creating the TraceTraget with ActionScript. Like so…

	

Deep down, in my core, I cannot find motivation to find out why this is so.

Explore posts in the same categories: Uncategorized

Comment: