From 2f317ba79f262a8cd325844a1a258efab22e5fa1 Mon Sep 17 00:00:00 2001 From: Jason Kölker Date: Mon, 13 Feb 2012 16:26:31 -0600 Subject: Allow file logging config * Fixes lp904305 * remove module level log functions (getLogger to rule them all) * Move specific Environment logging to the one place it is used * Wrap getLogger to return a logger wrapped in a NovaContextAdapter * Do not overwrite the root logger * save_and_reraise_exception logs via error for passing exc_info * Uses CommonConfigOptions for compatability across Openstack Projects * Prefers CommonConfigOptions over legacy options * Install a NullHandler on the root logger if configured by FLAGS * Include example logging config file to mimic Nova defaults Change-Id: Ie59c3f755c142e2b7dc3b94b4e82e142e157bfac --- nova/api/ec2/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'nova/api') diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 416783c45..937e1ed80 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -627,9 +627,13 @@ class Executor(wsgi.Application): context=context) return ec2_error(req, request_id, type(ex).__name__, unicode(ex)) except Exception as ex: - extra = {'environment': req.environ} - LOG.exception(_('Unexpected error raised: %s'), unicode(ex), - extra=extra, context=context) + env = req.environ.copy() + for k in env.keys(): + if not isinstance(env[k], basestring): + env.pop(k) + + LOG.exception(_('Unexpected error raised: %s'), unicode(ex)) + LOG.error(_('Environment: %s') % utils.dumps(env)) return ec2_error(req, request_id, 'UnknownError', _('An unknown error has occurred. ' 'Please try your request again.')) -- cgit