Google KMS on AppEngine Dev Server - logging clutter

后端 未结 3 1554
说谎
说谎 2020-12-21 10:38

This is a known issue: https://issuetracker.google.com/issues/63253097

Further to my question about getting Google KMS working with App

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-21 11:03

    This is quite annoying and there is a bug report for it.

    In the meantime we can filter out these messages but we need to figure out which logger they are using. See the docs for more info on how logging records are handled. Taking a look at the source for stubs.py I found:

    logging.info('Sandbox prevented access to file "%s"', filename)
    logging.info('If it is a static file, check that '
               '`application_readable: true` is set in your app.yaml')
    

    So they are using the root logger (bad practice generally). To filter out these messages on your root logger add the following to your appengine_config.py:

    import logging
    
    class StubsFilter(logging.Filter):
    
        def filter(self, record):
            return 'stubs.py' != record.filename
    
    logging.root.addFilter(StubsFilter())
    

提交回复
热议问题