Skip to content

Commit

Permalink
Set werkzeug logger to DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Oct 18, 2018
1 parent b228e7e commit 31324df
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ckan/config/middleware/flask_app.py
Expand Up @@ -2,6 +2,7 @@

import os
import re
import time
import inspect
import itertools
import pkgutil
Expand Down Expand Up @@ -111,6 +112,9 @@ def make_flask_stack(conf, **app_conf):
app = DebuggedApplication(app, True)
app = app.app

log = logging.getLogger('werkzeug')
log.setLevel(logging.DEBUG)

# Use Beaker as the Flask session interface
class BeakerSessionInterface(SessionInterface):
def open_session(self, app, request):
Expand Down Expand Up @@ -298,6 +302,8 @@ def ckan_before_request():
# with extensions
set_controller_and_action()

g.__timer = time.time()


def ckan_after_request(response):
u'''Common handler executed after all Flask requests'''
Expand All @@ -311,6 +317,11 @@ def ckan_after_request(response):
# Set CORS headers if necessary
response = set_cors_headers_for_response(response)

r_time = time.time() - g.__timer
url = request.environ['CKAN_CURRENT_URL'].split('?')[0]

log.info(' %s render time %.3f seconds' % (url, r_time))

return response


Expand Down

0 comments on commit 31324df

Please sign in to comment.