logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Log Files Not Written to Disk

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Undertowe



Joined: 03 Jan 2005
Posts: 33

PostPosted: Sun May 20, 2007 13:03    Post subject: Log Files Not Written to Disk Reply with quote

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
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sun May 20, 2007 14:39    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Sun May 20, 2007 17:17    Post subject: Reply with quote

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
View user's profile Send private message
nosfe



Joined: 25 Apr 2007
Posts: 22

PostPosted: Mon May 21, 2007 17:21    Post subject: Reply with quote

Shocked Shocked movie movie...i want really view thisss Shocked
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group