只是一个小烦恼,但似乎 AppEngine 的 NDB (Python) 正在为源自模型的错误生成警告,无论是否处理异常:
testCannotInsertWithoutCurrency (expense_test.ExpenseTest) ... {'amount': 9.9, 'description': 'Foo'}
WARNING:root:initial generator _put_tasklet(context.py:335) raised BadValueError(Entity has uninitialized properties: currency)
WARNING:root:suspended generator put(context.py:812) raised BadValueError(Entity has uninitialized properties: currency)
正如您从输出中看到的那样,我只是在编写测试,所以我实际上期望错误会发生并且我对警告产生的所有噪音不感兴趣。有什么办法可以禁用它吗?在文档中找不到有关日志级别等的任何信息。
最佳答案
您可以使用记录器的 setLevel 方法显式设置日志级别。
例如
logging.getLogger().setLevel(logging.INFO)
关于python - 谷歌应用引擎,NDB : Suppress tasklet warnings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23183186/