flexbuilder3.6 log winows7

来源:互联网 发布:微信淘宝优惠群怎么做 编辑:程序博客网 时间:2024/05/21 05:19

flexbuilder:3.6; 操作系统:win7 64bit

问题描述:在开发java项目的时候,前台使用flex展现,后台java程序,通讯使用BlazeDS进行通讯。但是在调试程序时,flex界面有时会出来有时又是灰色的。无法定位问题,所以需要使用log来进行打印。

本篇blog参考:http://www.riameeting.com/node/1042、http://yunzhongxia.iteye.com/blog/1150218,既然人家都是原创,我就转载吧。

1. 卸载现有flash player,下载最新flash player debugger(使用的是IE),截止目前可以下载Download the Windows Flash Player 12 ActiveX control content debugger (for IE)这个版本,地址是http://www.adobe.com/support/flashplayer/downloads.html;

2. 由于系统是win7,且使用的是Administrator登录,所以在C:\Users\Administrator目录下新建mm.cfg文件,内容为:

ErrorReportingEnable=1TraceOutputFileEnable=1MaxWarnings=0
3. 编写 flex代码,进行日志记录。

mxml:

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"creationComplete="init()"><mx:Script source="script/fansy/testscript.as" /><mx:Panel  id="myPanel"   width="100%" height="100%" title="测试"><mx:ApplicationControlBar><mx:Label text="this is a test page" /></mx:ApplicationControlBar></mx:Panel></mx:Application>
testscript.as:

// ActionScript file[Bindable]private var schemeId:String="" ;import mx.logging.LogLogger;                 import mx.logging.ILogger;                 import mx.logging.Log;                 import mx.logging.LogEventLevel;                 import mx.logging.targets.TraceTarget;                 private var logger:ILogger; private function init():void{var logTarget:TraceTarget = new TraceTarget();         logger = new LogLogger("testlog");         logTarget.filters = ["*"];         logTarget.level = LogEventLevel.ALL;         logTarget.includeCategory = true;         logTarget.includeDate = true;         logTarget.includeLevel = true;         logTarget.includeTime = true;         logTarget.addLogger(logger);         Log.addTarget(logTarget);    logger.info("first log in init()");trace("what the !!!");}
在C:\Users\Administrator\AppData\Roaming\Macromedia\Flash Player\Logs即可看到日志记录:







0 0
原创粉丝点击