Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Production Logging in Flex

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.

like image 794
Mike Deck Avatar asked Sep 19 '08 20:09

Mike Deck


3 Answers

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.

like image 151
hasseg Avatar answered Nov 02 '22 08:11

hasseg


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);
like image 2
Mike Deck Avatar answered Nov 02 '22 07:11

Mike Deck


I've used alcon in the past.

http://blog.hexagonstar.com/alcon/

like image 1
Joeri Sebrechts Avatar answered Nov 02 '22 07:11

Joeri Sebrechts