visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Web :: Performance issues :: Differential Reading from a text file


By: Najja U.S.A.  Date: 20/06/2003 00:00:00  English  Points: 25 Status: Answered
Quality : Excellent
Hello All,

My requirement may sound silly, but I badly need a solution.

I'm using VB.Net

I want to read from a log file, which is being updated frequently from another program, and process the information. This can be done. But I want to read the same log file again and again. That time there's no use of reading the old data which has already been processes. I cant purge the log file as I don have the ownership of that. So please tell me how can I read the differential data from the log file so that the growth of the log file wont effect the performance of my program.

Thanks in advance
By: VGR Date: 20/06/2003 05:45:00 English  Type : Answer
classical problem.

Either call some OS program/command like "tail" with parameters,
or
memorize after each processing the position/datetime of the last entry read, and try to read only the following lines the next time [not easy]

personally, I solve this problem by log-rotating the logs so that they stay small enough to permit fast read into memory
By: dbrunton Date: 20/06/2003 19:42:00 English  Type : Comment
If the log file is just being added too then count the number of lines when you process the file and save this number in a text file.

Next time get the number out of this text file and just read without processing this number of lines. Now process the rest of file counting the extra lines.

Total new number of lines and count you got out of text file and drop this total back into text file for next time.

Do register to be able to answer

EContact
browser fav
page generated in 331.470010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page