让logging.debug()在Google App Engine/Python上运行

bra*_*jam 25 python debugging google-app-engine

我刚刚开始为Google App Engine构建Python应用程序.在localhost环境中(在Mac上)

我正在尝试通过调试信息发送到GoogleAppEngineLauncher日志控制台logging.debug(),但它没有显示出来.但是,任何通过,比方说logging.info()logging.error() 确实出现的信息.我已经尝试了logging.basicConfig(level=logging.DEBUG)之前logging.debug(),但无济于事.

我错过了什么?

din*_*uti 8

如果有人使用Windows Google Application Launcher.可以在"编辑">"应用程序设置"下设置调试参数

在Extra Command Line Flags中,添加--log_level = debug


lac*_*ton 3

旗帜是--log_level debug

具体来说,使用以下命令行启动您的开发服务器:

dev_appserver.py --log_level debug .
Run Code Online (Sandbox Code Playgroud)

您可以通过运行找到此信息dev_appserver.py --help。以下是命令输出中的相关引用:

--log_level {debug,info,warning,ritic,error} 日志级别,低于该级别的应用程序代码生成的日志消息将不会显示在控制台上(默认值:info)

使用等号(即--log_level=debug)也可以,因为 python 脚本google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py依赖于该argparse模块,而后者以相同的方式处理空格和等号,如官方文档中所述。