2012-07-13 39 views
0

使用appcfg.py request_logs時,它顯示「將下載日誌複製到[輸出文件路徑]」。位置谷歌應用程序引擎用於存儲臨時文件在哪裏?同時使用谷歌appengine request_logs,它存儲臨時文件?

EDIT1

雖然使用appcfg.py request_logs,我注意到,第一個程序將首先下載存儲到一個臨時的地方然後將這些文件複製到用戶指定輸出文件。我正在查找將數據複製到目標日誌文件之前存儲的位置。

回答

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) 
1

我不知道我理解你的問題,但如果你從你的應用程序引擎項目目錄(在您app.yaml文件)運行如下命令:

appcfg.py request_logs . logs.out 

則輸出將結束在同一目錄(您的項目目錄)中的文件logs.out中。