]> git.ipfire.org Git - pakfire.git/commitdiff
Fix logging if not running in debug mode.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Feb 2011 16:30:40 +0000 (17:30 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Feb 2011 16:30:40 +0000 (17:30 +0100)
pakfire/config.py
pakfire/logger.py

index 556ac7e4a480f4d9102f88c23d32de52fe50d7c6..2a730cf8f48e4f3ee24c6515e8eb53d943bc0109 100644 (file)
@@ -14,7 +14,7 @@ class Config(object):
                self.pakfire = pakfire
 
                self._config = {
-                       "debug" : True,
+                       "debug" : False,
                        "logfile" : "/var/log/pakfire.log",
                        "source_download_url" : SOURCE_DOWNLOAD_URL,
                        "local_build_repo_path" : LOCAL_BUILD_REPO_PATH,
index eb06d974923b92a2a334ca50ccd58798428a4ce0..ab77778990fbe4c880bcea0977ec543767ace7eb 100644 (file)
@@ -13,16 +13,25 @@ def setup_logging(config):
                logging.debug("Logging was already set up. Don't do this again.")
                return
 
-       # Remove all previous defined handlers
+       # Remove all previous defined handlers.
        for handler in l.handlers:
                l.removeHandler(handler)
 
-       if config.get("debug"):
-               l.setLevel(logging.DEBUG)
+       # Set level of logger always to DEBUG.
+       l.setLevel(logging.DEBUG)
 
+       # But only log all the debugging stuff on console if
+       # we are running in debugging mode.
        handler = logging.StreamHandler()
+
+       if config.get("debug"):
+               handler.setLevel(logging.DEBUG)
+       else:
+               handler.setLevel(logging.INFO)
+
        l.addHandler(handler)
 
+       # The configuration file always logs all messages.
        handler = logging.FileHandler(config.get("logfile"))
        handler.setLevel(logging.DEBUG)
        l.addHandler(handler)