Saturday, February 24, 2007

Logging and Debugging deployed Flex applications

I want to share my experience with troubleshooting Flex problem in deployed environment. I am working on a application that uses web service as back end. I do development and basic testing in Flex Builder so I can run debugger and see trace outputs.

But lately I decided to try run my app from web container (tomcat). The first problem I encountered was my login screen doesn't work. I pressed login and nothing happened. I have code that uses Application.application.url parameter to figure out host site and based on url decide where to locate web services. In local debug environment I use hardcoded url (and it works fine), in deployed one I have code that construct url dynamically (and obviously it wasn't working well).

What should I do?

Luckily Flex Builder provides an easy way to run remote application (loaded from web container) in debug mode. First you need to make sure that you used -debug=true flag when you compiled your application. Once you done it, you can create a new debug run configuration in Flex Builder and specify url of deployed application and related project:



Now you just need to set breakpoints, press debug and see why something doesn't work.

Remote debug mode is quite convenient if you have full control over environment. But eventually your application would be deployed in customer site and most likely you would not be able to use debugger to trace down your problem.

To address this problem you need to make sure you have enough log statements in your code that would help to pinpoint the problem so make sure you are aware about mx.logging.* package.

It's very similar to java logging api and should not take long to figure out. The main caveat is that to use default trace facility(mx.logging.targets.TraceTarget) you need to run debug version of flash player. TraceTarget allows you to output message to system.out (eclipse console) or flashlog.txt. To make sure that flashlog.txt is created, you need to check that you have mm.cfg in your user home directory (in my case I didn't have mm.cfg created by installer). If you don't have mm.cfg - create it in C:\Documents and Settings\{username}\( obviously this window specific, check manual for linux path) and populate with parameter you want to use for ex.:

ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=100

Now you would be able to see flashlog.txt in c:\Documents and Settings\{username}\Application Data\Macromedia\Flash Player\Logs\.


Most likely you would not be able to use debug flash player in customer environment. You can write your own extension of flex logging classes to make sure you can capture trace event somehow. But the easier way to start with already existing flex logging extension "trace panel" from Adobe Flex Exchange (or directly from author's site http://www.faratasystems.com/?page_id=45) . It provide log capturer win32 application and source code for AbstractTarget that communicates with the win32 app and shows log statement when using none-debug version of flash player.



Hope this was helpful. If know some other techniques that can be used in Flex to simplify problem troubleshooting let me know.

12 comments:

Pradeep said...

I am using flex application integrate with java. I have problem while debugging this.

i always wrrapping swf file in to jsp using AC_FL_RunContent() java script function.

how can i debug this swf file while it is running with jsp

vinitha said...

I am using flex application with .net. How can i debug the application?

Thanks in advance..

Su said...

Thanks. I tried and it works!

mike said...

Works great -- thanks!

伊凡姐姐 said...

酒店打工

酒店兼職

台北酒店

打工兼差

酒店工作

酒店經紀

禮服店

酒店兼差

酒店上班

酒店PT

酒店

酒店上班請找艾葳 said...

艾葳酒店經紀公司提供專業的酒店經紀, 酒店上班小姐,八大行業,酒店兼職,傳播妹,或者想要打工兼差打工,兼差,八大行業,酒店兼職,想去酒店上班, 日式酒店,制服酒店,ktv酒店,禮服店,整天穿得水水漂漂的,還是想去制服店日領上班小姐,水水們如果想要擁有打工工作、晚上兼差工作兼差打工假日兼職兼職工作酒店兼差兼差打工兼差日領工作晚上兼差工作酒店工作酒店上班酒店打工兼職兼差兼差工作酒店上班等,想了解酒店相關工作特種行業內容,想兼職工作日領假日兼職兼差打工、或晚班兼職想擁有鋼琴酒吧又有保障的工作嗎???又可以現領請找專業又有保障的艾葳酒店經紀公司!

艾葳酒店經紀是合法的公司工作環境高雅時尚,無業績壓力,無脫秀無喝酒壓力,高層次會員制客源,工作輕鬆,可日領現領
一般的酒店經紀只會在水水們第一次上班和領薪水時出現而已,對水水們的上班安全一點保障都沒有!艾葳酒店經紀公司的水水們上班時全程媽咪作陪,不需擔心!只提供最優質的酒店上班,酒店上班,酒店打工環境、上班條件給水水們。心動嗎!? 趕快來填寫你的酒店上班履歷表

水水們妳有缺現領、有兼職缺錢便服店的煩腦嗎?想到日本留學缺錢嗎?妳是傳播妹??想要擁有高時薪又輕鬆的賺錢,酒店和,假日打工,假日兼職賺錢的機會嗎??想實現夢想卻又缺錢沒錢嗎!??
艾葳酒店台北酒店經紀招兵買馬!!徵專業的酒店打工,想要去酒店的水水,想要短期日領,酒店日領,禮服酒店,制服店,酒店經紀,ktv酒店,便服店,酒店工作,禮服店,酒店小姐,酒店經紀人,
等相關服務 幫您快速的實現您的夢想~!!

Kitty said...

高収入!短期間で稼げる在宅バイト案内
高時給♪短期間に稼げるライブチャット案内
高時給♪すぐに稼げる副業案内
日払いOK!手軽に稼げる副業情報
高収入!好きな時に稼げるチャットレディー案内
週払いOK!簡単に稼げる副業情報
週払い可能◎高額仕事情報
昼間だけOK!家で稼げる在宅ワーク情報
稼げる携帯チャトレバイト情報
日払いOK!楽々稼げる在宅ワーク情報
高時給♪すぐに稼げるアルバイト案内
高時給♪自由な時間に稼げる家仕事案内
初心者OK!すぐに稼げる小遣い稼ぎ情報
高時給♪育児中でも稼げるチャトレ情報
昼間だけOK!簡単に稼げるバイト情報
楽々稼げる高額携帯メールレディ募集
空いた時間に稼げる高時給携帯チャトレ募集
高収入ライブチャットアルバイト情報
彼氏に内緒で稼げる高単価携帯ライブチャット
高収入!30代でも稼げる在宅ワーク情報
夜だけOK!手軽に稼げる在宅バイト情報
稼げるノンアダルト高額ライブチャット募集
高時給♪人妻でも稼げるライブチャット情報
週払い可能◎高単価チャットレディー
稼げる安心高額チャトレ募集
高収入!自宅で稼げるアルバイト案内
高収入!学生でも稼げる在宅バイト情報
素人でも稼げる高単価携帯メールレディ募集
秘密厳守!安全に稼げるメールレディ
稼げるライブチャット求人サイト

Kitty said...

淫乱若妻出会い系無料 ♪ 不倫奥さん出会いBBS ♪ セフレ募集人妻と出会える ♪ 淫乱若妻と出会える ♪ セフレ募集中40代出会い系 ♪ 愛人主婦出逢い系 ♪ セフレ希望30代と出会い ♪ セフレ新妻と出会える ♪ SEX好き30代出会いBBS ♪ 愛人募集30代出会い系無料 ♪ 浮気希望ギャル妻出会い ♪ 愛人募集主婦出会いBBS ♪ セフレ希望奥さん完全無料出会い ♪ エロ系若妻出会いBBS ♪ SEX好き新妻掲示板 ♪ 不倫エロ妻出合い ♪ エロ系人妻とやれる出会い系 ♪ 不倫若妻無料出会い系 ♪ エロ系40代出合い ♪ やれる主婦即アポ出会い ♪ 

Dean said...

greetings to all.
I would first like to thank the writers of this blog by sharing information, a few years ago I read a book called Real Estate Investment costa rica in this book deal with questions like this one.

niz said...

Hello .. firstly I would like to send greetings to all readers. After this, I recognize the content so interesting about this article. For me personally I liked all the information. I would like to know of cases like this more often. In my personal experience I might mention a book called Generic Viagra in this book that I mentioned have very interesting topics, and also you have much to do with the main theme of this article.

咪摩兔 said...

借貸
汽車借款
借錢
借錢
二胎
票貼
票貼
借錢
二胎

咪摩兔 said...

借貸
借錢
二胎
汽車借款
酒店經紀