title: How to fetch logs continuously from logcat programmatically?
body: <p>I am fetching android logs using logcat with following piece of program:</p>
  
  <pre><code>Process process=runtime.exec("logcat"); 
  BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(process.getInputStream())); 
  FileOutputStream fos=new FileOutputStream("/sdcard/Pictures/logs.txt");
  String line; while((line=bufferedReader.readLine())!=null){
          fos.write(line.getBytes()); 
  }
  </code></pre>
  
  <p>But the problem is it will fetch all logs at once and will write to the file.</p>
  
  <p>However, I want to keep polling logcat for new logs and want to write the log to the file whenever there is a new log available.</p>
  
  <p>Can you please suggest a way to do this ?</p>