首页 > 代码库 > Flex 日志管理

Flex 日志管理

在Flex中调试方法有两种:

一是用trace()函数,在flex builder中进行调试;

二是用logTarget类,如下代码:

// Create a target.
var logTarget:TraceTarget = new TraceTarget();
// Log only messages for the classes in the mx.rpc.* and
// mx.messaging packages.
logTarget.filters = [ "mx.rpc.*", "mx.messaging.*" ];
// Log on fatal levels.
logTarget.level = LogEventLevel.FATAL;
// Add date, time, category, and log level to the output.
logTarget.includeDate = true;
logTarget.includeTime = true;
logTarget.includeCategory = true;
logTarget.includeLevel = true;
// Begin logging.
Log.addTarget(logTarget);

 

启用TraceTarget后,自动创建两个文件,

mm.cfg配置文件,在c:\users\username目录下;

flashlog.txt日志文件,在c:\users\username\AppData\Roaming\Macromedia\Flash Player\Logs下;




Flex 日志管理