Le 21 janv. 2011 à 12:24, mcelotti a écrit :

> 
> I have a product (plone3) that succesfully calls an external webservice to
> fetch data.
> I'd like to log some debug info (something like "callin method foo() with
> params ..."), but:
> 
> - if I use logger.debug() then in my buildout I must use "event-log-level =
> debug" to see my messages.
> this becomes a mess with tons of other zope-plone messages.
> 
> - if I use logger.info(), and in buildout "event-log-level = info", a user
> could not be interested in reading my messages (ie: a production
> environment)
> 
> I wish I could specify (like in Java with log4j) a logger level ONLY for my
> product, but as far as I know, this is not possible.
> 
> Any ideas?

(untested workaround but this should work)

logger = logging.getLogger('foo.bar')
if __DEBUGGING__:
    handler = logging.FileHandler('/somewhere/foo.bar.log')
    logger.addHandler(handler)

I use to do such things in unit tests (adding personal "in memory" handlers) to 
test log output.

> 
> Thanks
> -- 
> View this message in context: 
> http://plone.293351.n2.nabble.com/Plone3-logging-problem-tp5947315p5947315.html
> Sent from the Product Developers mailing list archive at Nabble.com.
> _______________________________________________
> Product-Developers mailing list
> [email protected]
> https://lists.plone.org/mailman/listinfo/product-developers

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/product-developers

Reply via email to