summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-01-11 09:43:09 -0500
committerSimo Sorce <ssorce@redhat.com>2012-01-11 12:04:23 -0500
commitd06acdbc9068ec5ff060cc9f941d5f348e36ed8c (patch)
treeae007931954bbb8a20a9699b68c90c98f521120c /ipaserver
parent843d116acbe312d082e30abd37b2f69771f9efaa (diff)
downloadfreeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.tar.gz
freeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.tar.xz
freeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.zip
Remove buffer log handling.
This is properly handled by the new logging subsystem.
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/installutils.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index f82d2ebc..817308f1 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -314,70 +314,6 @@ def port_available(port):
return rv
-class BufferingHandler(logging.Handler):
- log_queue = []
-
- def __init__(self):
- logging.Handler.__init__(self)
- self.level = logging.DEBUG
-
- def emit(self, record):
- self.log_queue.append(record)
-
- def flush(self):
- pass
-
-def bootstrap_logging():
- """
- Bootstrap logging and create special handler which will buffer any log
- emitted before standard_logging_setup is called. These will be later
- processed when the logging is set up.
- """
- root_logger = logging.getLogger()
- root_logger.setLevel(logging.DEBUG)
- root_logger.addHandler(BufferingHandler())
-
-def standard_logging_setup(log_filename, debug=False, filemode='w'):
- """
- Set up logging. bootstrap_logging() should be called earlier if there
- is a chance that a log is emitted before this setup.
- """
- root_logger = logging.getLogger()
- log_queue = []
-
- if root_logger.handlers:
- # Remove any handlers that may have been set and which may cause
- # problems with logging in install utils
- handler_list = list(logging.getLogger().handlers)
-
- for handler in handler_list:
- if isinstance(handler, BufferingHandler):
- log_queue.extend(handler.log_queue)
- root_logger.removeHandler(handler)
-
- old_umask = os.umask(077)
- # Always log everything (i.e., DEBUG) to the log
- # file.
- logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s %(levelname)s %(message)s',
- filename=log_filename,
- filemode=filemode)
- os.umask(old_umask)
-
- console = logging.StreamHandler()
- # If the debug option is set, also log debug messages to the console
- if debug:
- console.setLevel(logging.DEBUG)
- else:
- # Otherwise, log critical and error messages
- console.setLevel(logging.ERROR)
- formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
- console.setFormatter(formatter)
- logging.getLogger('').addHandler(console)
-
- for log_record in log_queue:
- root_logger.handle(log_record)
-
def get_password(prompt):
if os.isatty(sys.stdin.fileno()):
return getpass.getpass(prompt)