Hello,
I have a log file (or actually a text file), that a certain application writing into this file.
I want to create an application in c#, that can display the log file, and can display any change in the log file dynamically.
What is the best way to to that? Any recommendation?
Thanks!
Displaying a log file in c#
Page 1 of 11 Replies - 336 Views - Last Post: 01 December 2012 - 07:21 AM
Replies To: Displaying a log file in c#
#2
Re: Displaying a log file in c#
Posted 01 December 2012 - 07:21 AM
Assuming the other application is not locking the file for exclusive access, you can instantiate a FileWatcher that watches for changes in the file. When the event is fired, you read the contents of the file. Most log files are append only, so you only need read from the last point that you read from the previous event firing. Some log files are trimmed to a particular size, though, so you may need to backtrack through the file to find the last matching set of lines that you had previously displayed.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|