Pages

Friday, September 7, 2007

Logger

So .. I wrote a logger today for my flex and air app.

If u are creating logger for the first time.. and u are on the XP
You will have to follow the following steps

1) create "mm.cfg" file in

C:\Documents and Settings\user_name

2) then write ur logger and give the trace target..
A help about creating a logger is given at felxbuilder's help
few code snippet here :

import mx.logging.Log;
import mx.logging.ILogger;
var logObj = Log.getLogger(NameofClass); // for name of class u can just pass
// application class also
// mx.core.Application.application

and in main application :

<mx:TraceTarget level="0" includeDate="true" includeTime="true" includeCategory="true" includeLevel="true"> <mx:filters> <mx:Array> <mx:String>*</mx:String> </mx:Array> </mx:filters> </mx:TraceTarget>

and thats it..
then where u will write...
trace("trace me") or logObj.info("trace me")
The messaged is pushed to logfile

The location of the log file is

C:\Documents and Settings\user_name\Application Data\Macromedia\Flash Player\Logs\Flashlog.txt

Yes .. the log folder gets created.

:) info pushes the

No comments: