def DownloadLogs(self):
    if self.server:
      StatusUpdate('Downloading request logs for app %s server %s version %s.' %
                   (self.app_id, self.server, self.version_id))
    else:
      StatusUpdate('Downloading request logs for app %s version %s.' %
                   (self.app_id, self.version_id))





    tf = tempfile.TemporaryFile()
    last_offset = None
    try:
      while True:
        try:
          new_offset = self.RequestLogLines(tf, last_offset)
          if not new_offset or new_offset == last_offset:
            break
          last_offset = new_offset
        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 AppScale/appscale/AppServer/google/appengine/tools/appcfg.py/LogsRequester.DownloadLogs