View previous topic :: View next topic |
Author |
Message |
Undertowe
Joined: 03 Jan 2005 Posts: 33
|
Posted: Sun May 20, 2007 13:03 Post subject: Log Files Not Written to Disk |
|
|
I'm in the process of writing a bot in C# to parse virusman's NWNX Chat log file and route player tells to an IRC channel. A portion of my code works like the *nix tail -f command - it monitors the log file for changes and reads those changes when they occur. I'm using the .NET FileSystemWatcher class to accomplish this.
I ran into a problem, however, when I noticed that the FileSystemWatcher wasn't firing an event when the log file was being written. Puzzled, I did some digging around and eventually found the issue. I'm not very familiar with C++, but I discovered that fflush() - which is used by NWNX to write the log files - doesn't immediately write file changes to disk. Hence, the FileSystemWatcher wasn't detecting the write. The issue is described in more detail here:
http://support.microsoft.com/kb/66052
Could you change the way logs are written by NWNX so that writes are committed immediately to disk? This would allow me to trap the event and get my bot working. Not to mention, it would avoid the danger of data loss in the event of a crash.
Thanks much. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun May 20, 2007 14:39 Post subject: |
|
|
I have not done any performance measurements, but wouldn't this be bad, performance wise ?
Maybe the way to go would be to compile your own version of the chat plugin, which flushes the changes immediately... _________________ Papillon |
|
Back to top |
|
|
Grinning Fool
Joined: 12 Feb 2005 Posts: 264
|
Posted: Sun May 20, 2007 17:17 Post subject: |
|
|
You might also want to take it one step further -- integrate your bot into the chat plugin. Automatically send Tells directly to the channel, no need to monitor a log -- though I would recommend putting that in a thread for performance.
We're doing something similar in another month or so, allowing DMs to control and speak through NPCs via IRC. _________________ Khalidine, a NWN2 persistent world
Looking for volunteers. |
|
Back to top |
|
|
nosfe
Joined: 25 Apr 2007 Posts: 22
|
Posted: Mon May 21, 2007 17:21 Post subject: |
|
|
movie movie...i want really view thisss |
|
Back to top |
|
|
|