Skip to main content
 首页 » 编程设计

python之在基于 Buildout 的 Plone 项目的特定模块中使用不同的记录器级别

2025年05月04日76daizhj

我是 logging当 buildout 记录器级别设置为 DEBUG 时,需要呈现我们的一个 Plone 包的一些调试信息,但我发现使用这些信息有点困难,因为还有一些其他模块(如 Chameleontransaction ) 使用相同级别但非常冗长,如下所示:

2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: 7a9bea82827d89ebb6409b5b5b3c446f.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: 05974e2b844eb50bd08b35e69524ff1e.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: 05974e2b844eb50bd08b35e69524ff1e.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: fd6cd084759f934ad5b1873dcc864e89.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: fd6cd084759f934ad5b1873dcc864e89.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: 388b0bfda4923b35fa189b2f6f1e352e.py. 
2014-01-17 16:56:38 DEBUG chameleon.loader loading module from cache: 388b0bfda4923b35fa189b2f6f1e352e.py. 
2014-01-17 16:56:38 DEBUG txn.140171035764480 commit <Connection at 05b26150> 
2014-01-17 16:56:38 DEBUG txn.140171035764480 commit 
2014-01-17 16:56:38 DEBUG txn.140171035764480 new transaction 
2014-01-17 16:56:38 DEBUG txn.140171035764480 abort 
2014-01-17 16:56:38 DEBUG txn.140171035764480 new transaction 
2014-01-17 16:56:38 DEBUG txn.140171027371776 new transaction 
2014-01-17 16:56:38 DEBUG txn.140171035764480 commit 
2014-01-17 16:56:38 DEBUG txn.140171035764480 new transaction 
2014-01-17 16:56:38 DEBUG txn.140171035764480 abort 

有没有办法为这些其他模块提供不同的记录器级别?

我正在为我的 buildout.cfg 上的实例使用以下配置:

[instance] 
debug-mode = on 
event-log-level = DEBUG 
verbose-security = on 
z2-log-level = DEBUG 

请您参考如下方法:

您不能为构建中的特定模块(产品)设置调试级别。

构建 event-log-level 是一个全局设置。