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 Log
with static methods like log()
, debug()
, error()
etc. that I use in my apps, and this class forwards all messages sent to it into the trace stack via trace()
, 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.
There's a project on Google Code called Thunder Bolt that allows you to write log messages that will appear in FireBug when running the application in Firefox (assuming of course that you have that extension installed.)
Logging with this tool is as simple as:
import org.osflash.thunderbolt.Logger;
var myNumber: int = 5;
var myString: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);
I've used alcon in the past.
http://blog.hexagonstar.com/alcon/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With