是否可以从 Adobe AIR 中写入 Windows 事件日志?
Adobe AIR(通过 AS3)是否可以将事件写入操作系统的事件日志?特别是,我需要一个事件显示在 Windows 7 事件查看器中。我尝试使用 throw
抛出自定义错误,但它没有出现在应用程序日志中。
我知道我可以创建一个 NativeProcess
来执行此操作,但我希望有一个本机 AIR 解决方案。
到目前为止,谷歌搜索毫无结果。
Is it possible for Adobe AIR (via AS3) to write events to the OS's event log? In particular, I need an event to show up in the the Windows 7 Event Viewer. I've tried using throw
to throw a custom error, but it doesn't appear in the Application Logs.
I know I could create a NativeProcess
to do this, but I'm hoping there's a native AIR solution.
Google searches have, thus far, been fruitless.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新
虽然我最初的答案在技术上是正确的,但您需要了解一些知识,例如写入原始事件日志文件的数据格式。所以,这显然是一个问题。看来您最好的解决方案(尽管这不是您想要的解决方案)是编写一个快速可执行文件,您可以作为本机进程启动,该进程可以与执行此操作所需的 Windows C/CPP 库交互。这是一篇可以帮助您入门的文章:
http: //msdn.microsoft.com/en-us/library/dd996928(v=vs.85).aspx
AIR API 中不存在这样的东西的原因是目标AIR 的目标是成为一个跨平台 VM,(对于开发人员/用户)尽可能不了解其平台。这就是为什么您会发现最接近的平台集成本质上是文件 IO 和本机进程管理。
原始答案
只需找到系统上事件日志的位置,然后使用 AIR 文件 IO API 将原始数据附加到文件中即可。这里唯一可能的问题是用户权限,这些文件可能是只读的。
http://support.microsoft.com/kb/315417
Update
Although my original answer is technically right, you'd need to know several things like the data format for writing to the raw event log files. So, this is obviously a bit of an issue. It appears that your best solution, although it's not the solution you want, is to write a quick executable you can launch as a native process that can interface with the windows C/CPP libraries required to do this. Here is an article that should get you started:
http://msdn.microsoft.com/en-us/library/dd996928(v=vs.85).aspx
The reason why there would be no such thing existing within the AIR API is that the goal of AIR is to be a cross platform VM that is as agnostic (to the developer/user) about it's platform as possible. This is why the absolute closest platform integration you'll find is essentially file IO and native process management.
Original Answer
Just find the location of the event log(s) on the system and append the raw data to the file using the AIR file IO API's. The only possible issue here would be user permissions, these files may be read only.
http://support.microsoft.com/kb/315417