Esempio n. 1
0
    def doPost(self,request,response):
        self.valid_row_count = 0
        self.log_dic = {}
        sys.setrecursionlimit(sys.maxint)
        sb = []
        out = response.getWriter()
        
        self.log_para = request.getParameter("log")
        if self.log_para == None:
            self.log_para = self.default_log_para
        if self.log_para == None:
            self.log_para = '[request]\n' + warHome + '/logs/request.log*\n\n[sql]\n' + warHome + '/logs/sql.log*\n\n[method]\n' + warHome + '/logs/method.log*'
            
        ui_public.print_query_head(request, response);
        result = ui_public.parse_log_para(request, response, self.log_para)
        fs = result[0]['method']
        date_from = result[1]
        date_to = result[2]
        date_from_ms= date_from*1000
        date_to_ms = date_to*1000
        start_time = datetime.datetime.now()
        if request.getParameter("cmd") == "executeTime":
            self.statisticMethodExecuteTime(fs, sb, date_from_ms, date_to_ms)

        if request.getParameter('cmd') != None and len(request.getParameter('cmd')) > 0:
            cost = datetime.datetime.now() - start_time
            print request.getParameter('cmd'), ' cost, ', cost
            ui_public.print_result_head(request, response, fs, date_from, date_to, self.valid_row_count, cost)
        else:
            ui_public.print_query_form(request, response, self.log_para, [['executeTime', '统计method耗时']])
        #输出结果
        ui_public.print_result_content_html(request, response, sb)
Esempio n. 2
0
    def doPost(self, request, response):
        self.valid_row_count = 0
        self.log_dic = {}
        sys.setrecursionlimit(sys.maxint)
        sb = []
        out = response.getWriter()

        self.log_para = request.getParameter("log")
        if self.log_para == None:
            self.log_para = self.default_log_para
        if self.log_para == None:
            self.log_para = '[request]\n' + warHome + '/logs/request.log*\n\n[sql]\n' + warHome + '/logs/sql.log*\n\n[method]\n' + warHome + '/logs/method.log*'

        ui_public.print_query_head(request, response)
        result = ui_public.parse_log_para(request, response, self.log_para)
        fs = result[0]['method']
        date_from = result[1]
        date_to = result[2]
        date_from_ms = date_from * 1000
        date_to_ms = date_to * 1000
        start_time = datetime.datetime.now()
        if request.getParameter("cmd") == "executeTime":
            self.statisticMethodExecuteTime(fs, sb, date_from_ms, date_to_ms)

        if request.getParameter('cmd') != None and len(
                request.getParameter('cmd')) > 0:
            cost = datetime.datetime.now() - start_time
            print request.getParameter('cmd'), ' cost, ', cost
            ui_public.print_result_head(request, response, fs, date_from,
                                        date_to, self.valid_row_count, cost)
        else:
            ui_public.print_query_form(request, response, self.log_para,
                                       [['executeTime', '统计method耗时']])
        #输出结果
        ui_public.print_result_content_html(request, response, sb)
Esempio n. 3
0
    def doPost(self, request, response):
        self.valid_row_count = 0
        self.log_dic = {}
        sys.setrecursionlimit(sys.maxint)
        sb = []
        out = response.getWriter()

        self.log_para = request.getParameter("log")
        if self.log_para == None:
            self.log_para = self.default_log_para
        if self.log_para == None:
            self.log_para = '[request]\n' + warHome + '/logs/request.log*\n\n[sql]\n' + warHome + '/logs/sql.log*\n\n[method]\n' + warHome + '/logs/method.log*'

        ui_public.print_query_head(request, response)
        result = ui_public.parse_log_para(request, response, self.log_para)
        fs = result[0]['request']
        date_from = result[1]
        date_to = result[2]
        date_from_ms = date_from * 1000
        date_to_ms = date_to * 1000
        start_time = datetime.datetime.now()
        if request.getParameter("cmd") == "executeTime":
            self.statisticRequestExecuteTime(
                fs, sb, date_from_ms, date_to_ms,
                request.getParameter("match_user"),
                request.getParameter("match_url"))
        elif request.getParameter("cmd") == "sqlCount":
            self.statisticSqlCount(fs, sb, date_from_ms, date_to_ms,
                                   request.getParameter("match_user"),
                                   request.getParameter("match_url"))

        if request.getParameter("cmd") != None and len(
                request.getParameter("cmd")) > 0:
            cost = datetime.datetime.now() - start_time
            print request.getParameter("cmd"), ' cost, ', cost
            ui_public.print_result_head(request, response, fs, date_from,
                                        date_to, self.valid_row_count, cost)
        else:
            ext_code = '''<div style="padding:3px;">操作人(支持正则):<input type="text" size="50" name="match_user" value=""></div>
<div style="padding:3px;">URL(支持正则):<input type="text" size="50" name="match_url" value=""></div>'''
            ui_public.print_query_form(request, response, self.log_para,
                                       [['executeTime', '统计request耗时'],
                                        ['sqlCount', '统计request执行的SQL数']],
                                       ext_code)
        #输出结果
        ui_public.print_result_content_html(request, response, sb)
    def doPost(self,request,response):
        self.valid_row_count = 0
        self.log_dic = {}
        sys.setrecursionlimit(sys.maxint)
        sb = []
        out = response.getWriter()
        
        self.log_para = request.getParameter("log")
        if self.log_para == None:
            self.log_para = self.default_log_para
        if self.log_para == None:
            self.log_para = '[request]\n' + warHome + '/logs/request.log*\n\n[sql]\n' + warHome + '/logs/sql.log*\n\n[method]\n' + warHome + '/logs/method.log*'
            
        ui_public.print_query_head(request, response);
        result = ui_public.parse_log_para(request, response, self.log_para)
        fs = result[0]['request']
        date_from = result[1]
        date_to = result[2]
        date_from_ms= date_from*1000
        date_to_ms = date_to*1000
        start_time = datetime.datetime.now()
        if request.getParameter("cmd") == "executeTime":
            self.statisticRequestExecuteTime(fs, sb, date_from_ms, date_to_ms, request.getParameter("match_user"), request.getParameter("match_url"))
        elif request.getParameter("cmd") == "sqlCount":
            self.statisticSqlCount(fs, sb, date_from_ms, date_to_ms, request.getParameter("match_user"), request.getParameter("match_url"))

        if request.getParameter("cmd") != None and len(request.getParameter("cmd")) > 0:
            cost = datetime.datetime.now() - start_time
            print request.getParameter("cmd"), ' cost, ', cost
            ui_public.print_result_head(request, response, fs, date_from, date_to, self.valid_row_count, cost)
        else:
            ext_code = '''<div style="padding:3px;">操作人(支持正则):<input type="text" size="50" name="match_user" value=""></div>
<div style="padding:3px;">URL(支持正则):<input type="text" size="50" name="match_url" value=""></div>'''
            ui_public.print_query_form(request, response, self.log_para, [['executeTime', '统计request耗时'], ['sqlCount', '统计request执行的SQL数']], ext_code)
        #输出结果
        ui_public.print_result_content_html(request, response, sb)