Hello Graeme, The example you have posted the link to is not the better way to execute a task whenever a file changes: polling for file changes every 100ms and keeping the file handle open is definitely not the way to go. Instead, I suggest you to take a look at the FileSystemWatcher class [1]; you could use it to capture, among others, file/directory change and rename events, avoiding to place file system locks which could prevent, for example, file renaming. You could then code your data gathering logic inside the event handlers attached to the aforementioned events.
[1] http://msdn2.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx HTH Efran Cobisi http://www.cobisi.com Graeme Taylor wrote:
Hi, I am writing an application that will watch log files for certain text patterns appearing (e.g. errors / warnings). So far, I have created an application that picks up new lines and will check them using RegEx (based on CodeProject article http://www.codeproject.com/cs/files/tail.asp). However, most applications that create the logs will try to rename the log file when it reaches a certain size, at the moment, my Log Watching application is preventing this rename taking place. Would be grateful for any tips on how to get round this. Thanks in advance for any assistance, Graeme ___________________________________________________________ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html =================================== This list is hosted by DevelopMentor? http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
