[Pulp-list] Implicitly installing logging handlers is not good

Nick Coghlan ncoghlan at redhat.com
Fri Aug 5 05:29:37 UTC 2011


Hi,

Working on the Pulp web UI prototype, I just had to monkeypatch 
pulp.client.logutil.getLogger to replace it with the standard 
logging.getLogger().

The implicit handler it adds simply didn't work correctly in the context 
of a Django web app being served via Apache.

Implicitly adding handlers like that in library code runs specifically 
counter to advice from upstream:
http://docs.python.org/howto/logging.html#configuring-logging-for-a-library

The configuration of logging handlers would more appropriately be part 
of the cli code (e.g. in pulp.client.cli.core) rather than the 
underlying library.

Cheers,
Nick.

-- 
Nick Coghlan
Red Hat Engineering Operations, Brisbane




More information about the Pulp-list mailing list