0

使用 appcfg.py request_logs 时,它显示“将下载日志复制到 [输出文件路径]”。用于存储临时文件的位置谷歌应用程序引擎在哪里?

编辑1

在使用 appcfg.py request_logs 时,我注意到第一个程序会首先将日志下载到临时位置,然后将这些文件复制到用户指定的输出文件。我正在寻找将数据复制到目标日志文件之前存储的位置。

4

2 回答 2

1

我不确定我是否理解了您的问题,但是如果您从应用引擎项目目录(app.yaml文件所在的位置)运行这样的命令:

appcfg.py request_logs . logs.out

然后输出将最终出现在logs.out同一目录(您的项目目录)中的文件中。

于 2012-07-13T06:09:00.447 回答
0

我首先发现GAE首先使用标准临时文件来存储日志。然后将它们复制到所需的输出文件位置。

def DownloadLogs(self):
    """Download the requested logs.

    This will write the logs to the file designated by
    self.output_file, or to stdout if the filename is '-'.
    Multiple roundtrips to the server may be made.
    """
    StatusUpdate('Downloading request logs for %s %s.' %
                 (self.config.application, 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)
于 2012-07-16T06:55:04.987 回答