From 19b291d20d4e6d7d2479aae79ebce7a94a36f1b7 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 29 Oct 2012 11:05:57 -0400 Subject: [PATCH] Configure logging earlier. --- pecan/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pecan/__init__.py b/pecan/__init__.py index 82812ad..5263cb0 100644 --- a/pecan/__init__.py +++ b/pecan/__init__.py @@ -34,6 +34,14 @@ def make_app(root, static_root=None, logging={}, debug=False, existing_hooks.append(RequestViewerHook(conf.requestviewer)) kw['hooks'] = existing_hooks + # Pass logging configuration (if it exists) on to the Python logging module + if logging: + if isinstance(logging, Config): + logging = logging.to_dict() + if 'version' not in logging: + logging['version'] = 1 + load_logging_config(logging) + # Instantiate the WSGI app by passing **kw onward app = Pecan(root, **kw) @@ -48,14 +56,6 @@ def make_app(root, static_root=None, logging={}, debug=False, # Included for internal redirect support app = RecursiveMiddleware(app) - # Pass logging configuration (if it exists) on to the Python logging module - if logging: - if isinstance(logging, Config): - logging = logging.to_dict() - if 'version' not in logging: - logging['version'] = 1 - load_logging_config(logging) - # When in debug mode, load our exception dumping middleware if debug: app = DebugMiddleware(app)