in reply to Is a file currently being modified?

Assuming other applications visiting this logfile are playing nice too, you could use flock with the LOCK_NB bitflag set (that is Lock Non-Blocking). This will cause flock to return immediately instead of waiting for a lock. When it returns, its status will tell you whether it was granted a lock or not. If not, you know something else has the file locked. Flocking is voluntary, so scripts/programs that don't lock the file or check to see if it's locked won't play nice with applications that do.

As far as reading lines as they're being written, that's precarious. Due to buffering, you're unlikely to get line by line info, but rather chunks every so often.

By the way, another option would be to periodically check last modification time, or file size. A change there will indicate the file has been written to.