I am trying to write a custom logger target by extending TraceTarget and overriding the mx_internal function internalLog. I would like to send the occasional error log to our server for recording. I am doing this using an HTTPService, and sending it each time internalLog() is called.
However, if one does the following,
logTarget = new StandardLogTarget();
logTarget.filters=["*"];
logTarget.level = LogEventLevel.ALL;
the log target picks up logs generated by the HTTPService object inside the StandardLogTarget object. This produces an infinite loop. Also, I’m not concerned with the logs generated by the custom logger.
Is there a way around this problem?
You probably don’t care about this problem anymore, but a quick google search brought up your question, followed by a blog posting from an EffectiveUI employee about adding an exclusion filter to the Flex logging framework.
http://www.behindtheui.com/2008/09/adding-exclusion-to-flex-logging.html
It was back in 2008, so it’ll be for Flex 3 – but the logging part of the framework doesn’t seem to have changed much since then.
Alternatively you could also override the logEvent function to exclude any calls that are causing you problems, as demonstrated below.
http://techpolesen.blogspot.com/2007/07/sending-logs-to-server-using-custom.html