[英]On the google app engine, how do I change the default logging level of the dev_appserver.py?
Dev_appserver.py (the local development server for Python google app engine) spews tons of useless INFO messages. Dev_appserver.py(Python谷歌应用引擎的本地开发服务器)吐出大量无用的INFO消息。 I would like to up this to WARN or ERROR. 我想将此警告或错误。 How can I do that? 我怎样才能做到这一点?
I've tried the following, but it has no effect... 我已经尝试了以下方法,但是没有效果...
logger = logging.getLogger()
logger.setLevel(logging.WARN)
Any ideas? 有任何想法吗?
Currently, from the command line, you can only lower the logging level to DEBUG by the '-d' command line option. 当前,只能通过命令行-d选项将日志记录级别降低到DEBUG。
If you're not afraid of editing the scripts, look for 如果您不害怕编辑脚本,请查找
DEFAULT_ARGS = {
...
ARG_LOG_LEVEL: logging.INFO,
in C:\\Program Files\\Google\\google_appengine\\google\\appengine\\tools\\dev_appserver_main.py 在C:\\ Program Files \\ Google \\ google_appengine \\ google \\ appengine \\ tools \\ dev_appserver_main.py中
logging.getLogger().handlers[0].setLevel(logging.DEBUG)
from Google App Engine/Python - Change logging formatting , 来自Google App Engine / Python-更改日志记录格式 ,
This is a bit of a hack because you have to directly access the handlers list stored in the root logger. 这有点麻烦,因为您必须直接访问存储在根记录器中的处理程序列表。 The problem is GAE automatically uses logging before your code is ever run - this creates a default handler 问题是GAE在运行代码之前会自动使用日志记录-这会创建一个默认处理程序
Check if you have 检查你是否有
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
in your appengine-web.xml file, then go on to change .level = WARNING
in your logging.properties file. 在您的appengine-web.xml文件中,然后继续更改您的logging.properties文件中的.level = WARNING
。
That's it! 而已!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.