我正在嘗試調試this code。有了這個目標,我試圖在this tutorial之後使用日誌記錄。有了這個目標,我在我的腳本插入此代碼:如何查看GAE下的日誌模塊輸出模塊?
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logging.debug('This is a log message.')
而且,在我想要得到的消息記錄的部分,我插入的行:logging.debug ('This is a log message.')
這樣:
def fcount(self,f,cat):
res = db.GqlQuery("SELECT * FROM fc WHERE feature =:feature AND category =:category", feature = f, category = cat).get()
logging.debug('This is a log message.')
# res=self.con.execute(
# 'select count from fc where feature="%s" and category="%s"'
# %(f,cat)).fetchone()
if res is None: return 0
else:
res = fc.count
return float(res)
它事實證明我的申請是一個GAE申請。我看不到日誌消息,它沒有出現在瀏覽器或PyScripter IDE中。我應該在哪裏看到日誌消息的屏幕?
PS - 我想利用這個代碼寫交替記錄消息記錄到文件:
import logging
logging.basicConfig(filename='log_filename.txt', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logging.debug('This is a log message.')
但我發現一個I/O錯誤。
+1陳述的問題 – msw 2012-08-14 01:47:35