![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Is there a race condition reading the log? # Return all events that have occured since a particular one ($start) # If $start is negative, begin that many records from the current end of log. function read_log ([int]$start) $log = new-object system.diagnostics.eventlog("MyCustApp") if ($start -lt 0) {$start = $log.entries.count + $log.entries[0].Index + $start} if ($start -lt $log.entries[0].Index){$start = $log.entries[0].Index} $start = $start - $log.entries[0].Index - 1 while (++$start -lt $log.entries.count) { $log.entries.item($start) } } If the $start message number is far enough back in the log it might take a while to process all the messages. During that time it's likely that new messages will be added. When I first created the log and started reading it I didn't look at $log.entries[0].Index. Then all hell broke loose when the log got big enough for messages to roll off the back and $start no longer started in the right place. It essentially skipped loads of records. $start - $log.entries[0].Index takes care of that problem. But now I'm worried about what will happen if a job that reads the log happens to be reading when messages roll off. Imperically, it seems as though a bunch of messages will be skipped because the event index numbers will shift during processing. Any thoughts or experience with this? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Race Driver: GRID | Gaming | |||
| VPC IM driver(VMNetSrv.sys) race condition with nVidia nForce Ethe | Virtual PC | |||
| OTish, a race | Vista General | |||
| IE 7 cannot run, DoS condition | Vista General | |||