how to read a text file which is being actively written to by another program
posted 7 years ago
I'm running an application which writes info to a log file as it does it's thing
in my application, i need to monitor the progress by actively reading and parsing this log file
I tried using the lock mehod on nio file channel, each time locking a distinct part of the file which was already written, however when trying to actually read from the channel i'm getting -1 result, indicating that no bytes were found in the channel. i guess this is because the file wasn't properly closed yet.
can anyone provide code samples on how to read a text file which is being actively written to?