diff --git a/swift/common/middleware/catch_errors.py b/swift/common/middleware/catch_errors.py index f1ab249b25..eee45b8e1f 100644 --- a/swift/common/middleware/catch_errors.py +++ b/swift/common/middleware/catch_errors.py @@ -26,10 +26,10 @@ class CatchErrorMiddleware(object): def __init__(self, app, conf): self.app = app - try: - # if the application already has a logger we should use that one - self.logger = app.logger - except AttributeError: + # if the application already has a logger we should use that one + self.logger = getattr(app, 'logger', None) + if not self.logger: + # and only call get_logger if we have to self.logger = get_logger(conf) def __call__(self, env, start_response):