Search code examples
pythonloggingplonebuildout

Using different logger levels in specific modules on a Buildout-based Plone project


I'm logging some debug information on one of our Plone packages that needs to be rendered when the buildout logger level is set to DEBUG, but I found a little bit hard to use the information as there are some other modules (like Chameleon and transaction) that use this same level but are really verbose as you can see below:

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

is there any way to provide these other modules with a different logger level?

I'm using the following configuration for the instance on my buildout.cfg:

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

Solution

  • you can't change the log level of the other packages w/o patching them.

    however, you could use the next higher level (i think it's logger.warn() in your package change the instance to this level.

    alternatively you use grep on instance.log and grep only for your package's name there.