Disabling logging in 'transaction' package (Pyramid app)

时间:2016-04-04 18:21:22

标签: python transactions pyramid pylons

When debugging level of main logger in Pyramid app is set to DEBUG, transaction is spewing lots of pointless debug messages.

In Nosetests I can disable that this way:

from transaction._compat import get_thread_ident

txn_logger = logging.getLogger("txn.%d" % get_thread_ident())
txn_logger.setLevel(logging.WARN)

However, in Pyramid app the infrastructure adds "scoped session" to each HTTP request and that obviously means get_thread_ident() is different every time.

Is there some way of disabling that globally without repeating above in every single Pyramid view?

1 个答案:

答案 0 :(得分:1)

只需在日志配置中关闭system父记录器的日志记录。

txn