当您在 ActionScript 中使用 Flash Player 的普通版本(非调试版本)时,如何获取错误消息和堆栈跟踪?
我想在发布 Flash 应用程序后记录它的错误。
我会将日志保存在网络服务器上的文件中。
您知道当您使用普通版本(非调试版本)的 Flash Player 时如何获取错误消息和堆栈跟踪吗?
I want to log errors of my flash application after I released it.
I will save the logs on files on the web server.
Do you know how to get error message and stack trace when you use normal version(not debug version) of flash player?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,没有办法从 11.5 版之前的 Flash 播放器发行版本中获取堆栈跟踪。然而,2012 年 9 月 26 日的 Flash 播放器 beta 11.5 向发布的播放器添加了基本的堆栈跟踪。使用它时,Error.getStackTrace 会告诉您引发错误的类和函数,但不包括类路径或行。
公告:
http://forums.adobe.com/message/4732775
示例用法:
http://renaun. com/blog/2012/09/getting-the-stack-trace-in-a-release-flash-player/
如果您想从版本 SWF(不是使用 debug=true 构建的)获取堆栈跟踪,请使用调试闪存对于 beta 11.5 之前的玩家,您可以使用标志“-compiler.verbose-stacktraces”构建您的应用程序。
As far as I can find there's no way to get a stack trace from the release version of the Flash player before version 11.5. However, the 9/26/2012 Flash player beta 11.5 added a rudimentary stack trace to the release player. When using it, Error.getStackTrace tells you the class and function where the error was thrown, but does not include the classpath or line.
Announcement:
http://forums.adobe.com/message/4732775
Example usage:
http://renaun.com/blog/2012/09/getting-the-stack-trace-in-a-release-flash-player/
If you want to get stacktraces from a release SWF (one not built with debug=true) using debug Flash players prior to beta 11.5, you can build your app using the flag "-compiler.verbose-stacktraces".
客户端日志记录
如果您想在浏览器中(而不是在 Flash 调试器中)访问调试工具,有多种选择。
最简单的选择是下载浏览器扩展,并继续使用
跟踪
。我做了很多跨浏览器检查,所以我在 Utils 包中使用了自定义
log
函数来访问 JS 控制台:init.asloggingEnabled.as
有
log.as
很多可以改进的地方,以及使用此功能所需的一些东西。您需要定义 CONFIG::DEBUG,此外您还需要向舞台添加一个事件侦听器,以便
Event.ACTIVATE
和Event.DEACTIVATE
切换开启和关闭loggingEnabled
以防止闪存崩溃。您还需要提供对 Flash 视频的脚本访问权限。服务器端日志记录
如果您想使用 Flash 在服务器上记录消息,请使用 URLLoader 发送一个简单的 Url 请求,将消息作为参数传递给服务器端脚本。被调用的日志记录脚本需要使用服务器端语言(例如 PHP 或 ASP.NET)编写。
应注意验证来自 Flash 的请求,以防止恶意访问(您不希望有人将一些可执行代码注入您的文件系统)。
Client Side Logging
If you want to access debugging tools in-browser (rather than in the Flash Debugger), there are a number of options.
The simplest option is to download a browser extension, and continue to use
trace
.I do a bunch of cross-browser checking, so I've used a custom
log
function in my Utils package to access the JS console:log.as
init.as
loggingEnabled.as
There are a lot of things that can be improved, and a few things that are required to use this function. You'll need CONFIG::DEBUG defined, additionally you'll want to add an event listener to the stage for
Event.ACTIVATE
andEvent.DEACTIVATE
to toggleloggingEnabled
on and off to prevent flash from crashing. You'll also need to provide script access to the flash video.Server Side Logging
If you'd like to log messages on a server using Flash, send a simple Url Request using a URLLoader passing the message as a parameter to a server-side script. The logging script being called will need to be written in a server-side language such as PHP or ASP.NET.
Care should be taken to authenticate the request from Flash to prevent malicious access (you wouldn't want someone injecting some executable code into your filesystem).