summaryrefslogtreecommitdiffstats
path: root/ipalib/plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2010-02-09 04:57:23 -0700
committerRob Crittenden <rcritten@redhat.com>2010-02-09 16:36:27 -0500
commit0ce253fae4916a81310172798cce4433a600a862 (patch)
treefb22e60b2801921fd1db4ebf821b25f91c9ae051 /ipalib/plugable.py
parent8fd41d0434dddcd6959d460df7a9f8b736ac81ac (diff)
downloadfreeipa-0ce253fae4916a81310172798cce4433a600a862.zip
freeipa-0ce253fae4916a81310172798cce4433a600a862.tar.gz
freeipa-0ce253fae4916a81310172798cce4433a600a862.tar.xz
Fix logging in CLI and server (take 2)
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r--ipalib/plugable.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 6b2c6f7..4473409 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -365,11 +365,16 @@ class API(DictProxy):
self.env._finalize_core(**dict(DEFAULT_CONFIG))
log = logging.getLogger()
object.__setattr__(self, 'log', log)
- if log.level == logging.NOTSET:
- if self.env.debug:
- log.setLevel(logging.DEBUG)
- else:
- log.setLevel(logging.INFO)
+
+ # If logging has already been configured somewhere else (like in the
+ # installer), don't add handlers or change levels:
+ if len(log.handlers) > 0:
+ return
+
+ if self.env.debug:
+ log.setLevel(logging.DEBUG)
+ else:
+ log.setLevel(logging.INFO)
# Add stderr handler:
stderr = logging.StreamHandler()