Reading Application Logs on Google App Engine from Developer Console

余生颓废 提交于 2019-11-27 16:24:57

You don't need to set the logger options, just importing the logging module and invoking its functions should suffice, just like the in examples on the page you referenced:

import logging

import webapp2


class MainPage(webapp2.RequestHandler):
    def get(self):
        logging.debug('This is a debug message')
        logging.info('This is an info message')

You should also note that the application logs can not be seen independently, they are always attached to the request log for the request in response to which they were produced. From the doc you referenced:

Each request log contains a list of application logs (AppLog) associated with that request, returned in the RequestLog.app_logs property. Each app log contains the time the log was written, the log message, and the log level.

Note: A request log can only hold 1000 app logs. If you add more than 1000,
the older logs will not be retained.

You need to click on the left-most caret to expand the request log entry to display the respective app log(s):

If after expanding the request log you still don't see your app logs I suspect that your attempt to set options on a specific logger - the 'options_log' one - might be your problem. If you still want to set options, try doing it for the default logger (root logger?) instead of specifying one. Or drop the options altogether.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!