summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-02-20 23:36:36 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2011-02-20 23:36:36 -0800
commiteaddb9ea529672549af28cab4aacd2f8243c62a3 (patch)
tree8b771358ec1285cfa5ef0bc3573109870fe22f1b /nova
parent98c2ef77e6018c0a6233e32ace435fba488175f5 (diff)
remove extra references to logging.basicConfig
Diffstat (limited to 'nova')
-rw-r--r--nova/log.py19
-rw-r--r--nova/service.py1
-rw-r--r--nova/twistd.py1
-rw-r--r--nova/wsgi.py1
4 files changed, 13 insertions, 9 deletions
diff --git a/nova/log.py b/nova/log.py
index 12b695a41..0a863c921 100644
--- a/nova/log.py
+++ b/nova/log.py
@@ -160,20 +160,20 @@ class NovaLogger(logging.Logger):
logging.Logger.__init__(self, name, level)
self.initialized = False
if flags.FlagValues.initialized:
- self._setup_from_flags()
+ self.setup_from_flags()
- def _setup_from_flags(self):
+ def setup_from_flags(self):
"""Setup logger from flags"""
level_name = _get_level_from_flags(self.name)
self.setLevel(globals()[level_name])
self.initialized = True
if not logging.root.initialized:
- logging.root._setup_from_flags()
+ logging.root.setup_from_flags()
def isEnabledFor(self, level):
"""Reset level after flags have been loaded"""
if not self.initialized and flags.FlagValues.initialized:
- self._setup_from_flags()
+ self.setup_from_flags()
return logging.Logger.isEnabledFor(self, level)
def _log(self, level, msg, args, exc_info=None, extra=None, context=None):
@@ -276,18 +276,24 @@ class NovaRootLogger(NovaLogger):
NovaLogger.__init__(self, name, level)
self.addHandler(_streamlog)
- def _setup_from_flags(self):
+ def setup_from_flags(self):
"""Setup logger from flags"""
global _filelog
if FLAGS.use_syslog:
self.addHandler(_syslog)
+ else:
+ self.removeHandler(_syslog)
logpath = _get_log_file_path()
if logpath:
if not _filelog:
_filelog = WatchedFileHandler(logpath)
self.addHandler(_filelog)
self.removeHandler(_streamlog)
- return NovaLogger._setup_from_flags(self)
+ else:
+ self.removeHandler(_filelog)
+ self.addHandler(_streamlog)
+
+ return NovaLogger.setup_from_flags(self)
if not isinstance(logging.root, NovaRootLogger):
@@ -296,6 +302,7 @@ if not isinstance(logging.root, NovaRootLogger):
logging.root = NovaRootLogger("nova")
NovaLogger.root = logging.root
NovaLogger.manager.root = logging.root
+root=logging.root
def audit(msg, *args, **kwargs):
diff --git a/nova/service.py b/nova/service.py
index 59648adf2..02e86f6b3 100644
--- a/nova/service.py
+++ b/nova/service.py
@@ -215,7 +215,6 @@ class Service(object):
def serve(*services):
FLAGS(sys.argv)
- logging.basicConfig()
if not services:
services = [Service.create()]
diff --git a/nova/twistd.py b/nova/twistd.py
index 60ff7879a..0e4db022c 100644
--- a/nova/twistd.py
+++ b/nova/twistd.py
@@ -258,7 +258,6 @@ def serve(filename):
print 'usage: %s [options] [start|stop|restart]' % argv[0]
sys.exit(1)
- logging.basicConfig()
logging.debug(_("Full set of FLAGS:"))
for flag in FLAGS:
logging.debug("%s : %s" % (flag, FLAGS.get(flag, None)))
diff --git a/nova/wsgi.py b/nova/wsgi.py
index e01cc1e1e..280baa80b 100644
--- a/nova/wsgi.py
+++ b/nova/wsgi.py
@@ -59,7 +59,6 @@ class Server(object):
"""Server class to manage multiple WSGI sockets and applications."""
def __init__(self, threads=1000):
- logging.basicConfig()
self.pool = eventlet.GreenPool(threads)
def start(self, application, port, host='0.0.0.0', backlog=128):