Final few log tweaks, i18n, levels, including contexts, etc.
This commit is contained in:
		@@ -49,16 +49,13 @@ flags.DECLARE('network_size', 'nova.network.manager')
 | 
			
		||||
flags.DECLARE('num_networks', 'nova.network.manager')
 | 
			
		||||
flags.DECLARE('update_dhcp_on_disassociate', 'nova.network.manager')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LOG = logging.getLogger('nova-dhcpbridge')
 | 
			
		||||
if FLAGS.verbose:
 | 
			
		||||
    LOG.setLevel(logging.DEBUG)
 | 
			
		||||
LOG = logging.getLogger('nova.dhcpbridge')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_lease(mac, ip_address, _hostname, _interface):
 | 
			
		||||
    """Set the IP that was assigned by the DHCP server."""
 | 
			
		||||
    if FLAGS.fake_rabbit:
 | 
			
		||||
        LOG.debug("leasing ip")
 | 
			
		||||
        LOG.debug(_("leasing ip"))
 | 
			
		||||
        network_manager = utils.import_object(FLAGS.network_manager)
 | 
			
		||||
        network_manager.lease_fixed_ip(context.get_admin_context(),
 | 
			
		||||
                                       mac,
 | 
			
		||||
@@ -73,14 +70,14 @@ def add_lease(mac, ip_address, _hostname, _interface):
 | 
			
		||||
 | 
			
		||||
def old_lease(mac, ip_address, hostname, interface):
 | 
			
		||||
    """Update just as add lease."""
 | 
			
		||||
    LOG.debug("Adopted old lease or got a change of mac/hostname")
 | 
			
		||||
    LOG.debug(_("Adopted old lease or got a change of mac/hostname"))
 | 
			
		||||
    add_lease(mac, ip_address, hostname, interface)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def del_lease(mac, ip_address, _hostname, _interface):
 | 
			
		||||
    """Called when a lease expires."""
 | 
			
		||||
    if FLAGS.fake_rabbit:
 | 
			
		||||
        LOG.debug("releasing ip")
 | 
			
		||||
        LOG.debug(_("releasing ip"))
 | 
			
		||||
        network_manager = utils.import_object(FLAGS.network_manager)
 | 
			
		||||
        network_manager.release_fixed_ip(context.get_admin_context(),
 | 
			
		||||
                                         mac,
 | 
			
		||||
@@ -123,8 +120,8 @@ def main():
 | 
			
		||||
        mac = argv[2]
 | 
			
		||||
        ip = argv[3]
 | 
			
		||||
        hostname = argv[4]
 | 
			
		||||
        LOG.debug("Called %s for mac %s with ip %s and "
 | 
			
		||||
                  "hostname %s on interface %s",
 | 
			
		||||
        LOG.debug(_("Called %s for mac %s with ip %s and "
 | 
			
		||||
                    "hostname %s on interface %s"),
 | 
			
		||||
                  action, mac, ip, hostname, interface)
 | 
			
		||||
        globals()[action + '_lease'](mac, ip, hostname, interface)
 | 
			
		||||
    else:
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ from nova.compute import monitor
 | 
			
		||||
# TODO(todd): shouldn't this be done with flags?  And what about verbose?
 | 
			
		||||
logging.getLogger('boto').setLevel(logging.WARN)
 | 
			
		||||
 | 
			
		||||
LOG = logging.getLogger('nova-instancemonitor')
 | 
			
		||||
LOG = logging.getLogger('nova.instancemonitor')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,6 @@ from nova import crypto
 | 
			
		||||
from nova import db
 | 
			
		||||
from nova import exception
 | 
			
		||||
from nova import flags
 | 
			
		||||
from nova import log as logging
 | 
			
		||||
from nova import quota
 | 
			
		||||
from nova import utils
 | 
			
		||||
from nova.auth import manager
 | 
			
		||||
@@ -557,7 +556,6 @@ def main():
 | 
			
		||||
    utils.default_flagfile()
 | 
			
		||||
    argv = FLAGS(sys.argv)
 | 
			
		||||
 | 
			
		||||
    logging._set_log_levels()
 | 
			
		||||
    script_name = argv.pop(0)
 | 
			
		||||
    if len(argv) < 1:
 | 
			
		||||
        print script_name + " category action [<args>]"
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,6 @@ flags.DEFINE_string('ldap_netadmin',
 | 
			
		||||
flags.DEFINE_string('ldap_developer',
 | 
			
		||||
    'cn=developers,ou=Groups,dc=example,dc=com', 'cn for Developers')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LOG = logging.getLogger("nova.ldapdriver")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -506,7 +505,7 @@ class LdapDriver(object):
 | 
			
		||||
            self.conn.modify_s(group_dn, attr)
 | 
			
		||||
        except self.ldap.OBJECT_CLASS_VIOLATION:
 | 
			
		||||
            LOG.debug(_("Attempted to remove the last member of a group. "
 | 
			
		||||
                            "Deleting the group at %s instead."), group_dn)
 | 
			
		||||
                        "Deleting the group at %s instead."), group_dn)
 | 
			
		||||
            self.__delete_group(group_dn)
 | 
			
		||||
 | 
			
		||||
    def __remove_from_all(self, uid):
 | 
			
		||||
 
 | 
			
		||||
@@ -70,8 +70,7 @@ flags.DEFINE_string('credential_rc_file', '%src',
 | 
			
		||||
flags.DEFINE_string('auth_driver', 'nova.auth.dbdriver.DbDriver',
 | 
			
		||||
                    'Driver that auth manager uses')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LOG = logging.getLogger('nova.authmanager')
 | 
			
		||||
LOG = logging.getLogger('nova.auth.manager')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AuthBase(object):
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,7 @@ Nova-type exceptions. SHOULD include dedicated exception logging.
 | 
			
		||||
from nova import log as logging
 | 
			
		||||
LOG = logging.getLogger('nova.exception')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ProcessExecutionError(IOError):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
 | 
			
		||||
 
 | 
			
		||||
@@ -96,8 +96,9 @@ class Consumer(messaging.Consumer):
 | 
			
		||||
                                FLAGS.rabbit_retry_interval))
 | 
			
		||||
                self.failed_connection = True
 | 
			
		||||
        if self.failed_connection:
 | 
			
		||||
            LOG.exception(_("Unable to connect to AMQP server"
 | 
			
		||||
                " after %d tries. Shutting down.") % FLAGS.rabbit_max_retries)
 | 
			
		||||
            LOG.exception(_("Unable to connect to AMQP server "
 | 
			
		||||
                            "after %d tries. Shutting down."),
 | 
			
		||||
                          FLAGS.rabbit_max_retries)
 | 
			
		||||
            sys.exit(1)
 | 
			
		||||
 | 
			
		||||
    def fetch(self, no_ack=None, auto_ack=None, enable_callbacks=False):
 | 
			
		||||
 
 | 
			
		||||
@@ -209,9 +209,6 @@ def serve(*services):
 | 
			
		||||
    FLAGS(sys.argv)
 | 
			
		||||
    logging.basicConfig()
 | 
			
		||||
 | 
			
		||||
    # TODO(todd): make this pigggyback the flag-based level override method
 | 
			
		||||
    logging.getLogger('amqplib').setLevel(logging.WARN)
 | 
			
		||||
 | 
			
		||||
    if not services:
 | 
			
		||||
        services = [Service.create()]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,11 +36,11 @@ import webob.exc
 | 
			
		||||
 | 
			
		||||
from nova import log as logging
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# TODO(todd): should this just piggyback the handler for root logger
 | 
			
		||||
#             since we usually log to syslog, but changes if not daemonzied?
 | 
			
		||||
logging.getLogger("routes.middleware").addHandler(logging.StreamHandler())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Server(object):
 | 
			
		||||
    """Server class to manage multiple WSGI sockets and applications."""
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user