mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix logging in CLI and server (take 2)
This commit is contained in:
committed by
Rob Crittenden
parent
8fd41d0434
commit
0ce253fae4
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user