From ac11a11260d171b6a2937ee01c5c61f0964e82d2 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 10 Dec 2018 11:42:13 +0800 Subject: [PATCH] openresty error_logs --- plugins/openresty/index.html | 1 + plugins/openresty/index.py | 6 ++++++ static/app/public.js | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/plugins/openresty/index.html b/plugins/openresty/index.html index 750256c99..eda9543b4 100755 --- a/plugins/openresty/index.html +++ b/plugins/openresty/index.html @@ -5,6 +5,7 @@

自启动

配置修改

负载状态

+

错误日志

diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index c011258dc..a61a6cbdc 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -216,6 +216,10 @@ def runInfo(): return public.getJson(data) +def errorLogPath(): + return getServerDir() + '/nginx/logs/error.log' + + if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -238,5 +242,7 @@ if __name__ == "__main__": print getConf() elif func == 'run_info': print runInfo() + elif func == 'error_log': + print errorLogPath() else: print 'error' diff --git a/static/app/public.js b/static/app/public.js index e2d042d33..bbb9351c9 100755 --- a/static/app/public.js +++ b/static/app/public.js @@ -1705,4 +1705,31 @@ function pluginOpInitD(a, b) { }); }) } + +function pluginErrorLogs(_name, version){ + if ( typeof(version) == 'undefined' ){ + version = ''; + } + + var loadT = layer.msg('配置文件路径获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + $.post('/plugins/run', {name:_name, func:'error_log',version:version},function (data) { + layer.close(loadT); + + var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + var fileName = data.data; + $.post('/files/get_body', 'path=' + fileName, function(rdata) { + layer.close(loadT2); + if (!rdata.status){ + layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + if(rdata.data.data == '') rdata.data.data = '当前没有日志!'; + var ebody = '
'; + $(".soft-man-con").html(ebody); + var ob = document.getElementById('error_log'); + ob.scrollTop = ob.scrollHeight; + },'json'); + },'json'); +} /*** 其中功能,针对插件通过库使用 end ***/ \ No newline at end of file