[Win32utils-devel] Possible problems with EventLog#write
Heesob Park
phasis at gmail.com
Mon May 22 01:22:02 EDT 2006
Hi,
2006/5/22, Daniel Berger <djberg96 at gmail.com>:
> Heesob Park wrote:
>
> <snip>
> However, I took that general idea and came up with this solution:
>
> # Remove references to the @last instance variable first
> def tail(frequency=5)
> unless block_given?
> raise EventLogError, 'block missing for tail()'
> end
>
> old_total = total_records()
> flags = FORWARDS_READ | SEEK_READ
> rec_num = read_last_event.record_number
>
> while true
> new_total = total_records()
> if new_total != old_total
> read(flags, rec_num).each{ |log| yield log }
> old_total = new_total
> rec_num = read_last_event.record_number
> end
> sleep frequency
> end
> end
>
> I tail'd the Security log (where I could force lots of log entries by
> doing some random things with user accounts) and it handled it just fine.
>
> If you see any problems with this approach please let me know.
> Otherwise, I'm going to commit it later this week (along with updated docs).
>
It works fine. go ahead.
> However, that still leaves us with the bigint/long issue.
>
The bigint/long issue is only in c version of eventlog.
The source eventlog.c line #711
dwEventID = NUM2INT(v_event_id);
should be
dwEventID = NUM2ULONG(v_event_id);
Pure ruby version works fine.
Regards,
Park Heesob
More information about the win32utils-devel
mailing list