开发者

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. 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.


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


logging.getLogger().handlers[0].setLevel(logging.DEBUG)

from Google App Engine/Python - Change logging formatting,

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


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.

That's it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜