def DownloadLogs(self):
    StatusUpdate('Downloading request logs for %s %s.' %
                 (self.config.application, self.version_id))
    tf = tempfile.TemporaryFile()
    offset = None
    try:
      while True:
        try:
          offset = self.RequestLogLines(tf, offset)
          if not offset:
            break
        except KeyboardInterrupt:
          StatusUpdate('Keyboard interrupt; saving data downloaded so far.')
          break
      StatusUpdate('Copying request logs to %r.' % self.output_file)
      if self.output_file == '-':
        of = sys.stdout
      else:
        try:
          of = open(self.output_file, self.write_mode)
        except IOError, err:
          StatusUpdate('Can\'t write %r: %s.' % (self.output_file, err))
          sys.exit(1)
      try:
        line_count = CopyReversedLines(tf, of)
      finally:
        of.flush()
        if of is not sys.stdout:
          of.close()
    finally:
      tf.close()
    StatusUpdate('Copied %d records.' % line_count)
Download the requested logs.
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/tools/appcfg.py/LogsRequester.DownloadLogs