Is it possible to write to Windows Event Log from within Adobe 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 se开发者_开发知识库arches have, thus far, been fruitless.
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
精彩评论