in reply to Extract new lines from log file

Why not store the filesize instead of the line count? Then your 5 steps become

  1. Query filesize
  2. If the file has grown since last time, open the file and seek to the previous eof.
  3. Read the new lines and persist the new filesize.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."