diff options
author | Todd Willey <todd@ansolabs.com> | 2011-01-04 00:23:35 -0500 |
---|---|---|
committer | Todd Willey <todd@ansolabs.com> | 2011-01-04 00:23:35 -0500 |
commit | c7305af78049f94dedcbb55480b91a3c6d843b9f (patch) | |
tree | b8c0305cd39408f825270f0c253c7f487ee40727 /nova/utils.py | |
parent | dd1e36b9690a2c2de18c565c496b25295a13d0aa (diff) | |
download | nova-c7305af78049f94dedcbb55480b91a3c6d843b9f.tar.gz nova-c7305af78049f94dedcbb55480b91a3c6d843b9f.tar.xz nova-c7305af78049f94dedcbb55480b91a3c6d843b9f.zip |
Apply logging changes as a giant patch to work around the cloudpipe delete + add issue in the original patch.
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/nova/utils.py b/nova/utils.py index 15112faa2..cc632b835 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -22,7 +22,6 @@ System-level utilities and helper functions. import datetime import inspect -import logging import os import random import subprocess @@ -37,8 +36,10 @@ from eventlet import greenthread from nova import exception from nova.exception import ProcessExecutionError +from nova import log as logging +LOG = logging.getLogger("nova.utils") TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" @@ -109,7 +110,7 @@ def vpn_ping(address, port, timeout=0.05, session_id=None): def fetchfile(url, target): - logging.debug(_("Fetching %s") % url) + LOG.debug(_("Fetching %s") % url) # c = pycurl.Curl() # fp = open(target, "wb") # c.setopt(c.URL, url) @@ -121,7 +122,7 @@ def fetchfile(url, target): def execute(cmd, process_input=None, addl_env=None, check_exit_code=True): - logging.debug(_("Running cmd (subprocess): %s"), cmd) + LOG.debug(_("Running cmd (subprocess): %s"), cmd) env = os.environ.copy() if addl_env: env.update(addl_env) @@ -134,7 +135,7 @@ def execute(cmd, process_input=None, addl_env=None, check_exit_code=True): result = obj.communicate() obj.stdin.close() if obj.returncode: - logging.debug(_("Result was %s") % (obj.returncode)) + LOG.debug(_("Result was %s") % (obj.returncode)) if check_exit_code and obj.returncode != 0: (stdout, stderr) = result raise ProcessExecutionError(exit_code=obj.returncode, @@ -167,12 +168,12 @@ def default_flagfile(filename='nova.conf'): def debug(arg): - logging.debug('debug in callback: %s', arg) + LOG.debug(_('debug in callback: %s'), arg) return arg def runthis(prompt, cmd, check_exit_code=True): - logging.debug(_("Running %s") % (cmd)) + LOG.debug(_("Running %s"), (cmd)) rv, err = execute(cmd, check_exit_code=check_exit_code) @@ -203,7 +204,7 @@ def get_my_ip(): csock.close() return addr except socket.gaierror as ex: - logging.warn(_("Couldn't get IP, using 127.0.0.1 %s"), ex) + LOG.warn(_("Couldn't get IP, using 127.0.0.1 %s"), ex) return "127.0.0.1" @@ -296,7 +297,7 @@ class LazyPluggable(object): fromlist = backend self.__backend = __import__(name, None, None, fromlist) - logging.info('backend %s', self.__backend) + LOG.debug(_('backend %s'), self.__backend) return self.__backend def __getattr__(self, key): |