title: How to track changes (and most important read) really big files in Java efficiently
body: <p>I have a big log file in text form, created by a 3rd party app. Unfortunately my file is 150MB, others may have even bigger files, depending on the day they started logging. Since the file is created by a 3rd party application I can't really modify it in any way (remove some of it's oldest content for example).</p>
  
  <p>What I want to do is keep track of the file size and be notified when there is a new line added (thus the size of the file is altered) and then read this line (it will be the last line).</p>
  
  <p>I know when I want to keep track of the changes, it doesn't have to be a constant update, but when the user has the application minimized in the tray. Essentially, I want to notify the user about changes in the state of the application when he dcan't see them.</p>
  
  <p>Now I am tracking the differences in the size of the file using </p>
  
  <pre><code>File file = new File("filepath"); 
  file.length();
  </code></pre>
  
  <p>As far as I understand this doesn't load the file into the memory so it's not that much of a performance drop.</p>
  
  <p>If I am right <strong>what is the most efficient way to read the <code>last line</code> of that file?</strong></p>
  
  <p>Replace efficiency with "as low performance drop as possible". I don't mind a 2 or 3 seconds delay between the actual event being logged to the file and the user being notified.</p>