浏览代码

HUE-8030 [core] Log page hits on their return call so that they can be timed

[26/Feb/2018 14:10:14] "POST /jobbrowser/jobs/ HTTP/1.1" 200 12
[26/Feb/2018 14:10:44 +0000] connectionpool DEBUG    "localhost:8088 GET /ws/v1/cluster/apps?finalStatus=UNDEFINED&limit=1000&user.name=hue&user=romain&startedTimeBegin=1519078244000&doAs=romain HTTP/1.1" 200 None
[26/Feb/2018 14:10:44 +0000] resource     DEBUG    GET /cluster/apps Got response in 3ms: {"apps":null}
[26/Feb/2018 14:10:44 +0000] access       INFO     127.0.0.1 romain - "POST /jobbrowser/jobs/ HTTP/1.1" returned in 5ms
Romain Rigaux 7 年之前
父节点
当前提交
8868fb9
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      desktop/core/src/desktop/middleware.py

+ 3 - 2
desktop/core/src/desktop/middleware.py

@@ -315,7 +315,8 @@ class LoginAndPermissionMiddleware(object):
         return PopupException(
             _("You do not have permission to access the %(app_name)s application.") % {'app_name': app_accessed.capitalize()}, error_code=401).response(request)
       else:
-        log_page_hit(request, view_func, level=access_log_level)
+        if not hasattr(request, 'view_func'):
+          log_page_hit(request, view_func, level=access_log_level)
         return None
 
     logging.info("Redirecting to login page: %s", request.get_full_path())
@@ -335,7 +336,7 @@ class LoginAndPermissionMiddleware(object):
 
   def process_response(self, request, response):
     if hasattr(request, 'ts') and hasattr(request, 'view_func'):
-      log_page_hit(request, request.view_func, level=logging.DEBUG, start_time=request.ts)
+      log_page_hit(request, request.view_func, level=logging.INFO, start_time=request.ts)
     return response