I lied one, more.

Rob, I see you changed how the log level on the root logger is set in
API.bootstrap()... unfortunately, under the server and CLI, the result
is that the root logger always stays at its default level of
logging.WARNING, so none of our info() nor debug() messages are going
into the server log nor out to stderr (even with --debug).

My solution is to unconditionally set the root logger to logging.DEBUG,
the most verbose we use, and then configure the levels on individual
handlers as appropriate (which we already do).

Rob, I know you make this change because of problems with logging from
the installer, so can you see if still works the way you want it to with
this patch?  By the way, are you setting up your own logging handler in
the installer, or using the ones configured in API.bootstrap()?

Anyway, we really shouldn't release our alpha with broken logging.  Not
nice to our brave and helpful testers.  ;)


>From 8353bce4e6fc9ffce8dbee5dfeca06eb1ba34866 Mon Sep 17 00:00:00 2001
From: Jason Gerard DeRose <jder...@redhat.com>
Date: Mon, 8 Feb 2010 06:04:47 -0700
Subject: [PATCH] Fix logging in CLI and server

---
 ipalib/plugable.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 51c09fc..d73894b 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -382,11 +382,12 @@ 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)
+
+        # By default log.level is WARNING, so instead of testing against NOSET
+        # here (as we previously did), we'll just set the level of the root
+        # logger to the lowest level we use, DEBUG.  Set the level as approprate
+        # on individual handlers.
+        log.setLevel(logging.DEBUG)
 
         # Add stderr handler:
         stderr = logging.StreamHandler()
-- 
1.6.3.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to