Google KMS on AppEngine Dev Server - logging clutter

后端 未结 3 1284
盖世英雄少女心
盖世英雄少女心 2020-12-21 10:36

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 10:48

    I am a fulltime engineer working on dev_appserver. This log message is reported from /google/appengine/tools/devappserver2/python/stubs.py, in the method log_access_check_fail

    We added this log message to remind users of dev_appserver's behavior of blocking file access.

    Recommended workaround: dev_appserver.py --log_level warning

    --log_level sets the log level in local python runtime process. The log_access_check_fail() is set to INFO and would not be logged. NOTE, this flag will also prevent other INFO level logging in your application.

    Meanwhile, we are working on a fix to this log_access_check_fail method. It could be lowering log_access_check_fail() logging level to DEBUG.

    0 讨论(0)
  • 2020-12-21 10:54

    For me, these messages appear to originate from a GAE (.local) file called stubs.py.

    1. In my first case, stubs.py was looking for files that were not there. So you might want to check to see if "/usr/lib/Acrobat8/Resource/CMap" actually exists. Then, starting with stubs.py, try to find out what file is trying to load it.

      1. My project is using web.py, all of a sudden I started getting (stubs.py) messages again, this time about .pyc files. I put a skip_files: in the bottom of my app.yaml file, and it does suppress the messages, but I haven't tested to see if my app still fully compiles.

        skip_files:
        - ^(.*/)?\.pyc$
        

    More on the Python GAE runtime and sandbox here. https://cloud.google.com/appengine/docs/standard/python/runtime

    0 讨论(0)
  • 2020-12-21 11:00

    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())
    
    0 讨论(0)
提交回复
热议问题