In accordance with:
Java IO implementation of unix / linux "tail -f"
Java "tail -f" wrapper
I assume this is possible, but I have the following problem.
String TailCommand = "tail -f /path/PATH.txt| grep (...)"; Runtime r = Runtime.getRuntime(); Process p = r.exec(TailCommand); //handle buffer while (running) { // handle output }
The process p ends. It works great with teams that do not have constant updates unlike "top" or "tail -f".
Interestingly, I missed something, are there some limitations in the buffer, or something else? I use eclipse, but I think that this should not affect the behavior of the process.
Actually, maybe there is another easy way to solve my problem that I missed. I use tail -f because I have to analyze a rather bold (some GB) log that is constantly being added and is not going to open it and read the whole file. I only need to control the add lines. However, I did not find a suitable tail implementation
Thanks in advance.
source share