My first post here.
I want to monitorize Logs in real time.
Actually I made a simple class with this steps:
1º Get the file "target"
2º OpenAsync in READ mode, and make a event listener, in this listener I get the totalbytes of the file, close the stream, and start a timer.
3º The timer check every 10ms if the file "target" have changes in .modificationDate.getTime(). If the timer see a change, first compare totalbytes with the new bytes, if they are diferent, open a stream, put the stream.position in the diference of totalbytes and newbytes and read the changes, this "new bytes" go to a Text Area.
Well, here is the problem.
If the owner of the file "target" want to write new bytes at the same time I read the new bytes (fast process of writting in the log by the owner of file "target") I have a error in the app owner of the file "target", and my app crash.
How can I read this new bytes without this problem? I think the problem are where I READ the newbytes, because my app lock this file in the same time or a bit until of app owner of file "target" want write new bytes.
How can I solve this problem?
Sorry for my poor English. if want I´m in googlechat email@example.com