views:

525

answers:

4

I have an application that writes traces with a timestamp when certain items are clicked or accessed. I need to write these to a text log file so that they can be accessed remotely.. The device the app runs on doesn't have a web server and doesn't run the flash debug player, os is xp. How can I send these traces to a text file? I noticed Arthropod writes to an html file, but I need to do this automatically without interaction.. any suggestions?

A: 

You could set up a web host and write a web service that creates a log file or stores it on a database, and call the web service.

Or you could use something like dropbox or syncplicity to sync the local text file to their servers or another computer

sergiogx
The device has no outward access to the internet. The log files are retieved via 3G. I would also still have to create a text file to use dropbox or syncplicity... and that's where I'm stuck....
martin
+1  A: 

Adobe Air provides a file I/O API via the FileStream class.

You can also use it's embedded SQLite db if you need to store full logs.

Peiniau
Thanks you answer solved the problem!
martin
Good ! In that case it would be nice if you could mark this answer as correct. Cheers.
Peiniau
A: 

Adobe AIR is definitely the way to go, some obscure other possibilities could be:

use Flash 5 and fscommand("save", "file.txt"); see a post on moock.org

or you can store the data in a SharedObject and try to access the objects on the harddrive. More information here

Les
Thanks Les, yes Adobe Air saved the day
martin
A: 

I had this same problem with my video player. Here is what I came up with.

I created a static Log class that I use instead of trace.

Log.s("[info] Bla.onRemove")

Then inside the static s method I push the string into an array and trace the string. I added a right click option to copy the logs to their clipboard. Oh your might want to encrypt the logs so the user doesn't see them.

I had doubt about pushing this many items into an array. But after some profiling and testing I had over 60k items in the array and I didn't see any memory increase so I guess its fairly safe.

My other ideas was to make an AIR app and connect it via LocalConnection but I had some issues getting that connection to work. Although I have a lot less confidence in the stability of LocalConnections.

If you like this solution and want to see more code let me know.

jspooner