Flex/AS3 Logging with SOS
Monday 6 November 2006 @ 4:37 pm

I build two little classes to support logging from Flex/AS3 to SOS.

The logger implements the mx.logging.ILogger interface but not the rest of the mx.logging framework as I liked to keep things in the first way.
Check the example here (right click for source). If you want to test logging directly from a website you have to start a local webserver and put a crossdomain.xml in the root. For further details read here.
Check the source directly here.

“Flex/AS3 Logging with SOS” is open source and licensed under LGPL.

- Posted in Flex, OSFlash by Sönke  




6 Responses to 'Flex/AS3 Logging with SOS'

  1. Lieven Cardoen - February 13th, 2007 at 11:09 am

    Hi Sönke Rohde,

    I tried your classes and I get a few errors …

    SOSLogger Line 70 & Line 90 : Syntax Error : bitwiseand is unexpected
    SOSLogger Line 90 : Syntax Error : expecting rightbrace before xmltagendend
    SOSLogger Line 90 : Syntax Error : expecting rightparen before semicolon

    How can I resolve this?

    thx, Lieven Cardoen, IndieGroup, Belguim

  2. Sönke - February 18th, 2007 at 2:01 pm

    Hi,

    do you get the errors when compiling with mtasc?

  3. adampasz - February 23rd, 2007 at 4:57 am

    Thanks for this. It works great for me. Much better than the default method of tracing to a text file. :)

  4. adampasz - February 25th, 2007 at 1:07 am

    One problem I’ve encountered is that if SOS isn’t running and my code tries to log, it throws an exception that looks like this.
    at com.soenkerohde.logging::SOSLogger$cinit()
    at global$init()
    at com.soenkerohde.logging::LogFactory$/getLogger()….

    Putting a try/catch around the log statement didn’t help.

  5. Sönke - February 25th, 2007 at 7:14 pm

    I have also seen this problem but no solution yet.
    When you got it please tell me ;)

  6. Klaus - March 11th, 2008 at 10:33 am

    To catch this error you need to add a listener for the thrown IOErrorEvent:

    public function SOSLogger( _category:Object ) {
    this._category = _category;
    socket = new XMLSocket();
    socket.addEventListener(IOErrorEvent.IO_ERROR, communicationError);
    }

    private function communicationError(e:IOErrorEvent):void {
    trace(e);
    }

    Klaus


Leave a Reply