title: Writing String to Text File
body: <p>I am saving a log to a .txt file on the sdcard but once there is two lines saved, it overwrites it and starts over?</p>
  
  <p>Here is my code: </p>
  
  <pre><code>public static String getTimestamp() {
      try {
  
          SimpleDateFormat dateFormat = new SimpleDateFormat("MMMdd HH:mm:ss", Locale.getDefault());
          String currentTimeStamp = dateFormat.format(new Date()); // Find todays date
  
          return currentTimeStamp;
      } catch (Exception e) {
          e.printStackTrace();
  
          return null;
      }
  }
  
  public static void writeToLog(Context context, String string) {
      String text = getTimestamp() + " " + string;
      // ONLY SAVES TWO LINES
      try {
          PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true)));
          out.println(text);
          out.close();
      } catch (IOException e) {
          Log.d(Constants.APP_NAME, e.toString());
      }
  }
  </code></pre>
  
  <p>As soon as you mount /data in recovery, the log files in /sdcard &amp; /data/media/0 show the full log history but not when the device is powered on</p>