I want to create log file for my flex application. That is the file should contain all the trace prints in it when I run my flex application. How can I configure flex to do this? thanks
3 Answers
With the debug Flash Player, you can write your trace statements to disk by editing/creating the mm.cfg file.

- 17,983
- 6
- 53
- 65
-
I have done this, But I can not find the Log file. Do we need to create it or it is already created, when I run my application.???Thanks – Sarfraz Ahmed Apr 05 '12 at 10:44
-
The link above about mm.cfg [links to another page that has the info on the log file location](http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f-4867184d1239f9d0558-8000.html). Note, as the answer below suggests, this enabling this log is only for debugging. Writing trace statements to disk can slow down your app tremendously. – Sunil D. Apr 05 '12 at 16:12
That partly depends on where / how you want the log file to be accessible. If it's only something you / the development team is concerned about - esp in remote debugging scenarios, then a secondary tool which does the above should be sufficient.
However, if this is something that you want to see running in the app as a user, then you need to get a little more creative and try using the Logger class. It differentiates each log event by priority and has the ability to create an implementation - one of which is the trace logger. However the logger api still needs to be followed, and this means refactoring the actual trace statement itself to point to the logger instance.

- 949
- 6
- 6
I suggest that you take a look at: http://www.as3commons.org/as3-commons-logging/index.html Thats a library very similar to Log4j, I personally implemented a appender for AMF logging.
If you read the user guide http://www.as3commons.org/as3-commons-logging/userguide.html you'll see that it's very easy to log everything (and if you have Flash player 10 you could even log uncatched errors). The only downside is that with the normal flash player (not the debugger version) you can't get the stack trace.
Hope it helps

- 370
- 2
- 8