开发者

centralized logging with flex

we're developing an application and we need for this and further projects a centralized logging. I know there is a build in log api in flex builder 4.5. And the loger has a log target. All i found is how to send these loginformations to the trace console. But i'm looking for sending the logfiles to my server.

Maybe i can send messages to a webservice which fill a database in the backend. I dont'know if this is a recommanded way.

How do you stor开发者_如何学运维e your log informations centralized?

Thanks in advance Frank


Log4Fx offers some flexible logging solution on top of Flex logging with a couple of out-of-the-box server logging solutions. You can read more details here. Log4Fx is a part of free and open source Clear Toolkit.


There isn't an out of the box way to do this as far as I know.

I have a log class that has a connection to the server through a remote object. This could also be a web service.

I use a singleton pattern for that log class.

I use it to log errors in an AIR app. I have a global error handler to catch unhandled exceptions. I then call a log class that just calls a remote object and records the error to a log table.

The log class is flexible enough to handle debug and info statements. I pretty much copy the log4net way to log errors which allows me to specify a type (debug, error, info, ect) and a message. You could overload the method so you can send it more information (like message, elapsed time, userID, class, ect).

Here's a function that we use to log errors:

public function LogApplicationError(memberID:int, logger:String, message:String, name:String, stackTrace:String, responder:IResponder = null ):void
  {
      var asyncToken:AsyncToken = remoteObject.LogApplicationError(memberID, logger, message, name, stackTrace);

      trace("Member ID   : " + memberID.toString());
      trace("Logger      : " + logger);
      trace("Message     : " + message);
      trace("Name        : " + name);
      trace("Stack Trace : " + stackTrace);

      if( responder != null )
          asyncToken.addResponder( responder );
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜