Search

Logging JScript Errors to windows event log

Writing Jscript is a tough task, there were no errors if the data is well structured, but somtimes i wish to log all those information & exception in some place to review/analyse. Yes we can log all them in browser event log, but that is temprorary and will be all gone when the window is closed. Still there is something that you can do with Windows Event Logger. Here is a small script that uses activeXObject to write the log to eventviewer. Later you can view the log by running "eventvwer" in the cmd prompt.



And this is how you can call it:
 
// Calling the log to write error
EvntLog.Err("error in script");

Note: Due to inconsistent ActiveX use, it works only with InternetExplorer browser family :(
..keep coding