Is there any way to capture the trace statements of your Flex app while not running in debug mode?
Or is there any other way to output logging information when not running a debugger?
Currently I’m trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being useful in some instances for customers to send logs to tech support when they are reporting bugs or other problems.
I suppose you’re talking about Adobe Flex, targeting the Flash Player?
If so, you can write your own logging wrapper class that propagates log messages sent to it to several targets (like the trace stack and internal memory so that you can access the log from within the app and e.g. send it to a server when the user agrees to send a bug report). Also see the Flex logging framework for something like this that already exists.
I’ve actually done something like this — I have a class called
Logwith static methods likelog(),debug(),error()etc. that I use in my apps, and this class forwards all messages sent to it into the trace stack viatrace(), into a ‘log console’ app running on the same host via LocalConnection and/or Socket (a socket connection is obviously a lot faster than LocalConnection) and also saves them locally into an array so that users can send bug reports along with the log output right from within the app.This sort of a change of course means that you’d have to translate all
trace()commands in your code into calls to the logging system, but that can be easily achieved with a regex search & replace.