0

我想为我的 flex 应用程序创建日志文件。也就是说,当我运行我的 flex 应用程序时,该文件应该包含其中的所有跟踪打印。我如何配置 flex 来做到这一点?谢谢

4

3 回答 3

3

使用调试 Flash Player,您可以通过编辑/创建 mm.cfg 文件将跟踪语句写入磁盘。

于 2012-04-05T07:57:44.327 回答
2

这部分取决于您希望在何处/如何访问日志文件。如果这只是您/开发团队关心的事情 - 特别是在远程调试场景中,那么执行上述操作的辅助工具就足够了。

但是,如果这是您希望以用户身份在应用程序中运行的内容,那么您需要更有创意并尝试使用 Logger 类。它按优先级区分每个日志事件,并能够创建一个实现——其中之一是跟踪记录器。但是,仍然需要遵循 logger api,这意味着重构实际的 trace 语句本身以指向 logger 实例。

于 2012-04-05T14:59:57.820 回答
1

I suggest that you take a look at: http://www.as3commons.org/as3-commons-logging/index.html Thats a library very similar to Log4j, I personally implemented a appender for AMF logging.

If you read the user guide http://www.as3commons.org/as3-commons-logging/userguide.html you'll see that it's very easy to log everything (and if you have Flash player 10 you could even log uncatched errors). The only downside is that with the normal flash player (not the debugger version) you can't get the stack trace.

Hope it helps

于 2012-04-05T16:34:50.163 回答