R
R
I'm using the FileSystemWatcher class to track changes to a
Windows system logfile. Unfortunately, notifications are not
occurring for write operations on that file.
I'm using the sample code here:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
It's modified to contain this:
watcher.Filter = "*.log";
And I've supplied the correct directory name.
Notes:
I can see write operations occurring using Process Monitor, so
I know the log file is being written to. But my program doesn't
get notified. Also, the modification date does not change in a
Windows Explorer view after a write unless I manually refresh
the view. At that point the modified time is seen to change
*and* my program is notified of the LastWrite change. A similar
thing happens if I poll at 1 second intervals and retrieve the last
write time. That is, the LastWrite change notification seems to
appear after I make a System.IO.File.GetLastWriteTime method call.
I hope I've written this clearly enough. I'm not sure if I have.
Any suggestions on how to get this to work would be very welcome
as I'd like to avoid polling (which I know works).
Thanks.
Windows system logfile. Unfortunately, notifications are not
occurring for write operations on that file.
I'm using the sample code here:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
It's modified to contain this:
watcher.Filter = "*.log";
And I've supplied the correct directory name.
Notes:
I can see write operations occurring using Process Monitor, so
I know the log file is being written to. But my program doesn't
get notified. Also, the modification date does not change in a
Windows Explorer view after a write unless I manually refresh
the view. At that point the modified time is seen to change
*and* my program is notified of the LastWrite change. A similar
thing happens if I poll at 1 second intervals and retrieve the last
write time. That is, the LastWrite change notification seems to
appear after I make a System.IO.File.GetLastWriteTime method call.
I hope I've written this clearly enough. I'm not sure if I have.
Any suggestions on how to get this to work would be very welcome
as I'd like to avoid polling (which I know works).
Thanks.