从开发者控制台读取Google App Engine上的应用程序日志 [英] Reading Application Logs on Google App Engine from Developer Console

查看:136
本文介绍了从开发者控制台读取Google App Engine上的应用程序日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果在扩展请求日志后,您仍然看不到您的应用日志,我怀疑您尝试在特定的记录器上设置选项 - 'options_log' one - may 是您的问题。如果您仍想设置选项,请尝试使用默认记录器(root logger?)而不是指定一个。或者完全放弃这些选项。


Reading and Writing Application Logs discusses the difference between Request logs vs application logs.

In main.py running on App Engine I import logging and grab a logger (since it's named, options_log, I'm not using root logger):

import logging

log = logging.getLogger('options_log')
log.setLevel(logging.INFO)
...

log.info('Hello Log!')

I can't find any information on where to view my application logs in the Developer Console. I see only request_log and activity.

The request_log contains logging from main.py, but how do I log to application log and not request_log?

解决方案

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.

这篇关于从开发者控制台读取Google App Engine上的应用程序日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆