让logging.debug()在Google App Engine / Python上工作 [英] Getting logging.debug() to work on Google App Engine/Python
问题描述
我刚刚开始为Google App Engine搭建Python应用程式。在本地主机环境中(在Mac上)
I'm just getting started on building a Python app for Google App Engine. In the localhost environment (on a Mac)
我正在尝试通过 logging.debug()<>将调试信息发送到GoogleAppEngineLauncher日志控制台/ code>,但它没有显示。然而,发送的任何内容,例如
logging.info()
或 logging.error()
/ em>显示。我在 logging.debug()
之前尝试了一个 logging.basicConfig(level = logging.DEBUG)
,但是无法使用。
I'm trying to send debug info to the GoogleAppEngineLauncher Log Console via logging.debug()
, but it isn't showing up. However, anything sent through, say, logging.info()
or logging.error()
does show up. I've tried a logging.basicConfig(level=logging.DEBUG)
before the logging.debug()
, but to no avail.
我缺少什么?
推荐答案
标志是 - log_level debug
。
具体来说,使用以下命令行启动您的dev服务器:
Concretely, start your dev server with this command line:
dev_appserver.py --log_level debug .
您可以通过运行 dev_appserver.py --help
。以下是命令输出的相关引用:
You can find this information by running dev_appserver.py --help
. Here's the relevant quote from the command output:
- log_level {debug,info,warning,critical,error}
日志级别下面,应用程序代码生成的日志消息
将不会显示在
控制台上(默认值:info)
--log_level {debug,info,warning,critical,error} the log level below which logging messages generated by application code will not be displayed on the console (default: info)
使用等号(即 - log_level = debug
)也可以正常工作,因为python脚本 google-cloud-sdk / platform /google_appengine/google/appengine/tools/devappserver2/devappserver2.py
依赖于 argparse
模块,后者处理两个空格和等号同样的方式,如官方文档所述。
Using an equal sign (i.e., --log_level=debug
) will also work, because the python script google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py
relies on the argparse
module, and the latter handles both spaces and the equal sign the same way, as stated in the official doc.
这篇关于让logging.debug()在Google App Engine / Python上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!