system event viewer help
junk at aol.com
junk at aol.com
Wed Jun 4 15:56:25 EDT 2003
When I run this script instead of giving me information from my System
log it pulls information from my Application log. I'm sure I'm missing
something simple but I cant seem to get it to work no matter what I do.
import win32evtlog, win32evtlogutil
win32evtlog.OpenEventLog(None, "System")
win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
print "Event Viewer System log"
def CheckRecord(record):
if str(record.EventType)=="2":
print "Have Warning for %s written at %s" % \
(record.SourceName, record.TimeWritten.Format())
elif str(record.EventType)=="1":
print "Have Error for %s written at %s " % \
(record.SourceName, record.TimeWritten.Format())
win32evtlogutil.FeedEventLogRecords(CheckRecord)
More information about the Python-list
mailing list