I want to display a logfile on a webpage, essentially as though I were running
tail -f logfile.txt
and the output were displayed in a scrolling part of a webpage (with the latest updates appearing at the bottom of the section with older text scrolling upwards out of view).
This is as part of a monitoring screen for testing the system I am working on.
So far I am using long polling from the browser (using XMLHttpRequest) , calling an api that is returning the whole logfile. The webservice is using FileSystemWatcher to monitor for updates to the logfile, returning the whole logfile to the browser when updates are made.
This obviously is sending the whole logfile whenever it is updated which is no good at all.
How do I monitor the log file so that I can retrieve just the lines that have been added?
UPDATED
I used this answer http://stackoverflow.com/a/24993767/3195477 (rather than the accepted answer).