0

Is it possible to save logs of Trace somewhere, so that I can look up traces for players?

1 Answer 1

1

Yes, but for that you need a logger function instead of trace(). By the way, if you compile your SWF in release mode, no traces will happen. Say like this one:

private static var COMPLETE_LOG:String=''; public static function log(...args):void { var i:int; var s:String='\n'; for (i=0;i<args.length;i++) { if (i>0) s+=' '; s+=args[i].toString(); } COMPLETE_LOG+=s; } 

Use log() instead of trace() to capture traces you need. And then say upload that COMPLETE_LOG somewhere.

Sign up to request clarification or add additional context in comments.

4 Comments

So I should just upload a file called COMPLETE_LOG? And I can't see where I should enter the directory for it..
It's not a file, it's a String variable that will contain all your logs. Flash does not automatically save files anywhere, only on user demand. To upload, you need a mechanism to accept such uploads first, and the solution will depend on this.
Thanks a lot. But I found a method to post informations to a PHP file, and was thinking of just doing such, and then I will just send all 'trace's to the PHP and let it save it.. Isn't that a good idea aswell? Or would this be a bad idea?
Basically correct. You send a request with one of the parameters be this string (UUencode it or unescape to make it parsable by PHP), and process it on the server as a complete set of traces. If you need real-time trace sending, do that instead of logging into a local variable.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.